This file contains hidden or 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
SpecBegin(TTUser) | |
describe(@"TTUser", ^{ | |
__block TTUser *user; | |
__block NSDictionary *userDict; | |
before(^{ | |
userDict = @{ @"name" : @"Hormell Ansley", @"email" : @"[email protected]", @"id" : @1 }; | |
}); | |
This file contains hidden or 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
2013-10-02 19:48:30.386 collection[8782:70b] Cell center.y: 1610.000000 | |
2013-10-02 19:48:30.386 collection[8782:70b] ScrollView center.y: 284.000000 | |
2013-10-02 19:48:30.387 collection[8782:70b] fucking math: 1326.000000 | |
2013-10-02 19:48:30.387 collection[8782:70b] Cell center.y: 1280.000000 | |
2013-10-02 19:48:30.387 collection[8782:70b] ScrollView center.y: 284.000000 | |
2013-10-02 19:48:30.388 collection[8782:70b] fucking math: 996.000000 | |
2013-10-02 19:48:30.388 collection[8782:70b] Cell center.y: 1500.000000 | |
2013-10-02 19:48:30.388 collection[8782:70b] ScrollView center.y: 284.000000 | |
2013-10-02 19:48:30.388 collection[8782:70b] fucking math: 1216.000000 | |
2013-10-02 19:48:30.389 collection[8782:70b] Cell center.y: 1170.000000 |
This file contains hidden or 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
- (NSMapTable *)stringMap | |
{ | |
NSMapTable _map = [[NSMapTable alloc] init] | |
[_map setObject:@"some string" forKey:@(MyLoginAction0)]; | |
[_map setObject:@"some other string" forKey:@(MyLoginAction1)]; | |
[_map setObject:@"some final string" forKey:@(MyLoginAction3)]; | |
return _map | |
} | |
textLabel.text = [self stringMap][@(self.postLoginAction)] |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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 gfontenot on github. | |
* I am gfontenot (https://keybase.io/gfontenot) on keybase. | |
* I have a public key whose fingerprint is FC96 877D E91A C0B4 381D D33A 0BF4 A6C7 2DA8 F9CE | |
To claim this, I am signing this object: |
This file contains hidden or 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 | |
class DispatchGroup { | |
private var blocks: [dispatch_block_t] = [] | |
private let dispatch_queue = dispatch_queue_create("com.dispatch_group.foo", DISPATCH_QUEUE_CONCURRENT) | |
private let dispatch_group = dispatch_group_create() | |
func andThen(block: dispatch_block_t) -> Group { | |
blocks += [block] | |
return self |
This file contains hidden or 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 | |
infix operator >>- { associativity left precedence 150 } | |
public func >>-<T, U>(a: T?, f: T -> U?) -> U? { | |
return a.flatMap(f) | |
} | |
extension Optional { | |
func flatMap<U>(f: T -> U?) -> U? { | |
switch self { |
This file contains hidden or 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 Argo | |
import Runes | |
func +<T, V>(lhs: [T: V], rhs: [T: V]) -> [T: V] { | |
var dict = lhs | |
for (key, val) in rhs { | |
dict[key] = val | |
} | |
return dict |
This file contains hidden or 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
// Original implementation with multiple returns: | |
class func fromId(id: String) -> Office? { | |
let officesData = JSONData.load("offices") as? [[String: String]] ?? [] | |
let officeData = officesData.filter { $0["id"] == id }.first | |
if let office = officeData { | |
return decode(JSONValue.parse(office)) | |
} | |
This file contains hidden or 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
// stored property, no default value | |
let foo: String | |
// stored property, default value | |
let foo: String = "foo" | |
// or | |
let foo = "foo" | |
// computed property, no custom setter | |
var foo: String { |