Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* This is the clock interface. It's really simple, you write it once, use it anywhere.
* Cool extra things you can do:
* - have it return custom value objects
* - separate method for currentDate() without time part
*/
interface Clock
{
@baruica
baruica / vm.sh
Created March 4, 2014 12:39 — forked from jakzal/vm.sh
Run commands on a Vagrant VM
#!/usr/bin/env bash
VM_PROJECT_DIR="/home/vagrant/project"
COMMAND="$1"
shift
run() {
vagrant ssh -c "cd $VM_PROJECT_DIR ; $*"
}

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)
  5. All currencies are subdivided.
  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.