Skip to content

Instantly share code, notes, and snippets.

@zadr
zadr / oops.m
Last active February 11, 2016 05:23
- (void) performMagic:(Incantation) incantation interruptingCurrentSpell:(BOOL) immediately {
switch ((int)immediately) {
case NO:
[self _magic:incantation];
break;
default:
dispatch_async(wand_queue, ^{ [self _magic:incantation]; });
}
}
internal extension SequenceType where Element: Hashable {
/**
Returns a modified djb hash of all of the elements in a list.
Reference: http://www.eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx
*/
internal var hashValue: Int {
get {
return reduce(0) { (x, element) -> Int in
return 33 * x ^ element.hashValue
}