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
#define JB_COMMON_INIT(superInit) \ | |
^id (typeof(self) __self) { \ | |
if (!(__self = superInit)) return nil; \ | |
[__self commonInit]; \ | |
return __self; \ | |
}(self) | |
#endif |
This file has been truncated, but you can view the full file.
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
3855728084165267427602774016750250750215154106538872005386275855200744485445722025212324644501868066020574030848366545271557552452518623475628808471607805366146042844883512647401525020570854014608124013521304812045232864231700262123702578364031843118116261537140056271742313651014420820321100133372050070378031505885182656485588734415104052338850581814138006722620651370728436302406050044726786416844607314360422635540182808583336308432545463025646165037726804586378005674841671672482458306107452383564852175062662277678550628387345015272846345561300861357201485634205351633420725284162180656386141025825675788806620713311774070317340573370214864328103007114110056080572775463215274412730663374005645366375156133121605012634751028225653072063046022817823366871643172031543814374656032716142262666177080720815637324870836071657383654154358782080354335327626814221411316864580353703312577388585481010705873761448604854534242852555763251015864165726413145286355326261107874126751386512782183550652744140057877126457877825071871 |
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
### Keybase proof | |
I hereby claim: | |
* I am jakebromberg on github. | |
* I am jakebromberg (https://keybase.io/jakebromberg) on keybase. | |
* I have a public key whose fingerprint is 9028 194A 2F87 1267 26E8 342C B120 B683 C4FB 0DA0 | |
To claim this, I am signing this object: |
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
@interface NSString (Append) | |
- (NSString *(^)(NSString *))append __attribute__((const)); | |
@end | |
@implementation NSString (Append) | |
- (NSString *(^)(NSString *))append | |
{ |
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
#define keypath(object, keypath) \ | |
((void)(NO && ((void)object.keypath, NO)), @ # keypath ) |
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
// generators provide a 'one shot' mechanism for repeatedly computing the next element. | |
struct FibonacciGenerator<T: IntegerArithmeticType> : GeneratorType { | |
var num1 : T | |
var num2 : T | |
mutating func next() -> T? { | |
let value = num1 | |
(num1, num2) = (num2, num1 + num2) |
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
import Swift | |
import UIKit | |
protocol EventType { | |
typealias RegistrationType : Hashable | |
typealias MessageType | |
mutating func registerObserver(observer: RegistrationType, callback: MessageType -> ()) | |
mutating func removeObserver(observer: RegistrationType) | |
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
final class Node<T>: Sequence { | |
let value: T | |
var next: Node<T>? | |
init(_ value: T, next: Node<T>?) { | |
self.value = value | |
self.next = next | |
} | |
func makeIterator() -> List<T> { |
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
import Foundation | |
import Swift | |
extension Int { | |
public func pow(exp: Int) -> Int { | |
return (0..<exp).reduce(1) { (acc, _) in | |
return acc * self | |
} | |
} | |
} |
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
extension Sequence where Element == Int { | |
func pairsOfSum(k: Int) -> [(Int, Int)] { | |
var cache = [Int:Int]() | |
var result = [(Int, Int)]() | |
for i in self { | |
cache[i] = k - i | |
} | |
for (num, inv) in cache { |
OlderNewer