Skip to content

Instantly share code, notes, and snippets.

//Because swift thinks remainder is cooler than modulus
func modulus(number: Double, modulo: Double) -> Double {
var result = number % modulo
if result < 0 {
result += modulo
}
return result
}
@akosma
akosma / set.swift
Created September 3, 2014 13:20
Set operations described in Swift using operators and NSSet instances
// Set operations taken from
// https://en.wikipedia.org/wiki/Set_(mathematics)
import Foundation
// The empty set
let Ø = NSSet()
// The "Universal" set
let U = NSMutableSet()
#!/bin/bash
# We need the TAB character for SED (Mac OS X sed does not understand \t)
TAB="$(printf '\t')"
function abort {
echo "$(tput setaf 1)$1$(tput sgr0)"
exit 1
}
@bfoz
bfoz / fixup_committer_date.sh
Created September 7, 2010 19:24
Force GIT_COMMITTER_DATE = GIT_AUTHOR_DATE
git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"'