Skip to content

Instantly share code, notes, and snippets.

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@liveink
liveink / gdoc2xml.xml
Created March 2, 2012 02:15
gdoc to xml
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Spreadsheets Converter"
description="This gadget will convert spreadsheet data to either JSON, XML, or SQL INSERT statements. The user must specify a range that includes column headers, but it can have any amount of columns or rows."
author="Pamela Fox"
author_affiliation="Google Inc."
author_email="pamela.fox+coolgadget@gmail.com"
screenshot="http://pamela.fox.googlepages.com/screenshot_spreadsheetsconverter.jpg"
thumbnail="http://pamela.fox.googlepages.com/thumbnail_spreadsheetconverter.jpg" >
<Require feature="idi"/>
// parseUri 1.2.2
// (c) Steven Levithan <stevenlevithan.com>
// MIT License
function parseUri (str) {
var o = parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
uri = {},
i = 14;
@paulmkoch
paulmkoch / SoundCloud Custom Tracking File
Created May 15, 2014 17:17
SoundCloud Custom Tracking File
<script>
(function(){var requirejs,require,define,__inflate;(function(e){function a(e,t){var n=t&&t.split("/"),i=r.map,s=i&&i["*"]||{},o,u,a,f,l,c,h;if(e&&e.charAt(0)==="."&&t){n=n.slice(0,n.length-1),e=n.concat(e.split("/"));for(l=0;h=e[l];l++)if(h===".")e.splice(l,1),l-=1;else if(h===".."){if(l===1&&(e[2]===".."||e[0]===".."))return!0;l>0&&(e.splice(l-1,2),l-=2)}e=e.join("/")}if((n||s)&&i){o=e.split("/");for(l=o.length;l>0;l-=1){u=o.slice(0,l).join("/");if(n)for(c=n.length;c>0;c-=1){a=i[n.slice(0,c).join("/")];if(a){a=a[u];if(a){f=a;break}}}f=f||s[u];if(f){o.splice(0,l,f),e=o.join("/");break}}}return e}function f(t,n){return function(){return u.apply(e,s.call(arguments,0).concat([t,n]))}}function l(e){return function(t){return a(t,e)}}function c(e){return function(n){t[e]=n}}function h(r){if(n.hasOwnProperty(r)){var s=n[r];delete n[r],i[r]=!0,o.apply(e,s)}if(!t.hasOwnProperty(r))throw new Error("No "+r);return t[r]}function p(e,t){var n,r,i=e.indexOf("!");return i!==-1?(n=a(e.slice(0,i),t),e=e.slice(i+1),r=
function f() {
var c = [];
$(".js-donut-graph").each(function(g, e) {
var b = $(e);
e = {a:e, b:parseInt(b.css("width")), g:parseInt(b.data("score")), c:parseInt(b.data("avgScore")), canvas:void 0};
c.push(e);
b = h(e.b, e);
$(e.a).append(b);
e.canvas = b;
});
@mvaisakh
mvaisakh / Bringup.md
Last active April 26, 2024 10:24
An Android Device Tree Bringup Guide

A small Device Tree Bringup Guide

Introduction

So, you guys might be wondering, how do these "Developers" get your favourite Custom roms, such as LineageOS, Paranoid Android etc., to their own devices. Well I'm here to Guide you on how to do it, specifically on how to bringup or make your own device tree from scratch or adapting.

Gist of this Guide: This is for people with genuine interest in Android OS porting/development. After going through this guide, you should be able to do a total device tree bringup on your own.

Prerequisite: Certain requirements are to be met before you start with this amazing journey.

Searching 476 files for "angular"
/Users/adrianlee/Dropbox/Shared/project_course_rating_system/temp_course_rating/public/app.js:
1 var ratemycourse = {};
2: var App = angular.module('ratemycourse', ['ngResource']);
3
4 App.config(['$routeProvider', function($routeProvider) {
/Users/adrianlee/Dropbox/Shared/project_course_rating_system/temp_course_rating/public/libs/angular-resource.min.js:
1 /*
// ==UserScript==
// @name ShareTwitterOnTumblr
// @namespace http://white.s151.xrea.com/
// @description Share Twitter conversation on Tumblr as Chat
// @include http://twitter.com/*
// @include https://twitter.com/*
// @include http://explore.twitter.com/*
// @include http://m.twitter.com/*
// @include http://twitter.1x1.jp/search/*
// @include http://terraminds.com/twitter/*
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active April 26, 2024 10:22
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@timothymcmackin
timothymcmackin / get_link_title.html
Created May 30, 2018 20:56
Jekyll extension to resolve related links from front matter and create links in the output