Skip to content

Instantly share code, notes, and snippets.

@tobywf
tobywf / rounding.py
Created April 9, 2017 16:24
Decimal rounding to the nearest multiple (plus unit tests)
from decimal import Decimal, ROUND_CEILING, ROUND_FLOOR
ONE = Decimal(1)
def round_up(number, quantum):
"""Round a decimal number up to the nearest multiple of quantum"""
return (number / quantum).quantize(ONE, rounding=ROUND_CEILING) * quantum
@tobywf
tobywf / meldmerge.rb
Last active October 14, 2016 01:32
Homebrew cask for yousseb's Meld.dmg
cask 'meldmerge' do
version 'osx-9'
sha256 '324e096e0253e8ad4237f64a90cdda200fe427db8cf7ebc78143fc98e2d33ebc'
url "https://github.com/yousseb/meld/releases/download/#{version}/meldmerge.dmg"
name 'Meld'
homepage 'https://yousseb.github.io/meld/'
app 'Meld.app'
binary "#{appdir}/Meld.app/Contents/MacOS/Meld", target: 'meld'

Keybase proof

I hereby claim:

  • I am tobywf on github.
  • I am tobywf (https://keybase.io/tobywf) on keybase.
  • I have a public key whose fingerprint is 90A8 0C6B 788D 1574 F349 AA29 B0BF 051F 9B20 2065

To claim this, I am signing this object: