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 coryalder on github. | |
* I am ca (https://keybase.io/ca) on keybase. | |
* I have a public key whose fingerprint is ADB2 34A2 549E BC4B 4EB5 0276 819C 75BF 9A12 6635 | |
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
// Playground - noun: a place where people can play | |
import UIKit | |
class MyItem { /* some model properties */ } | |
protocol ItemViewProtocol: class { | |
// some protocol methods (e.g. updateWithItem(), etc) | |
func setupItem(item: MyItem) | |
init(String) |
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
row1 = 0,0 1,0 2,0 3,0 | |
row2 = 0,1 1,1 2,1 3,1 | |
row3 = 0,2 1,2 2,2 3,2 |
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
char str[100]; | |
fgets (str, 100, stdin); | |
NSString *inputString = [[NSString alloc] initWithUTF8String:str]; | |
inputString = [inputString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; | |
NSLog(@"Input was %@", inputString); |
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
func traverse(keyPath: [String], dict: Dictionary<String, AnyObject>?) -> AnyObject? { | |
if dict == nil { | |
return nil | |
} | |
var paths = keyPath | |
let next = paths.first! | |
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
// What's the best syntax for this: | |
// no trailing-closures | |
// explicit about what's happening, but those ()'s aren't needed... can we do better? | |
throwActions.filter({ $0.direction == dir }).map({ $0.action() }) | |
// all trailing closures | |
// weirdly looks like we're mapping the block, rather than the result of filtering throwActions using that block. |
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
-(void)viewDidAppear:(BOOL)animated { | |
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:(CGRect){-50,-50,100,100}]; | |
// 0, 0 is center | |
CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init]; |
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 Cocoa | |
// basic strings | |
var str: String = "Hello," | |
let helloWorld = str + " world" |
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
// when specify id as the type, you can use NSObject methods. | |
// when you specify as a custom protocol, you cannot. | |
// UNLESS you say that your custom protocol includes <NSObject> | |
#import <Foundation/Foundation.h> | |
@protocol CustomProtocol // <NSObject> // uncommenting <NSObject> fixes the issue | |
@end |
OlderNewer