This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground - noun: a place where people can play | |
import UIKit | |
func zero<N>(succ: N -> N) -> N -> N { | |
return { (z: N) in | |
return z | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground - noun: a place where people can play | |
import UIKit | |
// MARK: Utilities | |
func take<T>(slice: Slice<T>, num: Int) -> Slice<T> { | |
let n = (num < slice.count) ? num : slice.endIndex | |
return slice[0..<n] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure I have autoconf and automake both installed. | |
sudo port -v install automake | |
sudo port -v install autoconf | |
# Grab Frederic's patched valgrind on his "homebrew" branch | |
cd ~/work # My usual project directory | |
git clone https://github.com/fredericgermain/valgrind/ -b homebrew | |
cd valgrind | |
# Because he placed VEX as a git submodule, we have to make sure we clone it too | |
git submodule init | |
git submodule update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OBJC_PRINT_IMAGES "log image and library names as they are loaded" | |
OBJC_PRINT_LOAD_METHODS "log calls to class and category +load methods" | |
OBJC_PRINT_INITIALIZE_METHODS "log calls to class +initialize methods" | |
OBJC_PRINT_RESOLVED_METHODS "log methods created by +resolveClassMethod: and +resolveInstanceMethod:" | |
OBJC_PRINT_CLASS_SETUP "log progress of class and category setup" | |
OBJC_PRINT_PROTOCOL_SETUP "log progress of protocol setup" | |
OBJC_PRINT_IVAR_SETUP "log processing of non-fragile ivars" | |
OBJC_PRINT_VTABLE_SETUP "log processing of class vtables" | |
OBJC_PRINT_VTABLE_IMAGES "print vtable images showing overridden methods" | |
OBJC_PRINT_CACHE_SETUP "log processing of method caches" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'strscan' | |
def construct_dict_literal(pairs, mutable = false) | |
output = pairs.each_slice(2).reduce('@{') { | |
|expr, pair| | |
value, key = *pair | |
expr << key.strip << ': ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ampex' | |
def qs(xs) | |
return xs if xs.length <= 1 | |
p = xs.length / 2 | |
qs(xs.select &X < xs[p]) + | |
qs(xs.select &X == xs[p]) + | |
qs(xs.select &X > xs[p]) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input = """ | |
75 | |
95 64 | |
17 47 82 | |
18 35 87 10 | |
20 04 82 47 65 | |
19 01 23 75 03 34 | |
88 02 77 73 07 63 67 | |
99 65 04 28 06 16 70 92 | |
41 41 26 56 83 40 80 70 33 |