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)drawRect:(CGRect)rect | |
{ | |
[super drawRect:rect]; | |
rect = [self bounds]; | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGContextSaveGState(context); | |
// use the same background color as the view, but with an alpha of 1.0 |
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
@property(retain) NSString *foo; | |
void setFoo:(NSString *)s { | |
[release foo]; | |
foo = [s retain]; | |
} |
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 performRequest<A: Decodable>(request: NSURLRequest, callback: (Result<A>) -> ()) { | |
let task = NSURLSession.sharedSession().dataTaskWithRequest(request) { data, urlResponse, error in | |
let responseResult = Result(error, Response(data: data, urlResponse: urlResponse)) | |
let result = responseResult >>> parseResponse | |
>>> decodeJSON | |
>>> A.decode | |
callback(result) | |
} | |
task.resume() | |
} |
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
var gistPrefix = 'http://gist.github.com/', | |
// Cache document.write so that it can be restored once all Gists have been | |
// embedded. | |
cachedWrite = document.write, | |
body = $('body'), | |
// Map each p.gist to an object that contains the paragraph to be replaced | |
// and the Gist's identifier. | |
gists = $('p.gist').map(function(n, p) { | |
p = $(p); |