Skip to content

Instantly share code, notes, and snippets.

[self rac_liftSelector:@selector(displayRegion:)
withSignals:self.selectedRegion, nil];
-(void)displayRegion:(WTFRegion *)region {
[self.mapView setVisibleMapRect:region.rect animated:YES];
[self.mapView addAnnotations:[self fetchAnnotationsForRegions:region]];
}
[self rac_liftSelector:@selector(doSomethingWithFoo:Bar:Baz:)
withSignals:foos, bars, baz, nil];
-(void)doSomethingWithFoo:(NSString*)aFoo bar:(NSUInteger)aBar baz:(WTFBaz*)baz;
@rudyjahchan
rudyjahchan / C5RACNonRACAble.m
Last active August 29, 2015 14:10
None RAC Able Example
RAC(self, 'titleLabel.text') = [self.selectedRegion map:^NSString*(WTFRegion *region) {
return region.title;
}];
__weak id weakSelf = self;
[self.selectedRegion subscribeNext:^(WTFRegion *region) {
id strongSelf = weakSelf;
[strongSelf.mapView setVisibleMapRect:region.rect animated:YES];
[strongSelf.mapView addAnnotations:[strongSelf fetchAnnotationsForRegions:region]];
}];
@rudyjahchan
rudyjahchan / C5RACExample.m
Last active August 29, 2015 14:10
RAC Example
RAC(self, 'titleLabel.text') = [self.selectedRegion map:^NSString*(WTFRegion *region) {
return region.title;
}];
@rudyjahchan
rudyjahchan / C5RACBasicSubscription.m
Last active August 29, 2015 14:10
Basic ReactiveCocoa Example
__weak id weakSelf = self;
[self.selectedRegion subscribeNext:^(WTFRegion *region) {
id strongSelf = weakSelf;
strongSelf.titleLabel.text = region.title;
[strongSelf.mapView setVisibleMapRect:region.rect animated:YES];
[strongSelf.mapView addAnnotations:[strongSelf fetchAnnotationsForRegions:region]];
}];
if (cluster.isMaster)
cluster.fork() for i in [0...numCPUs]
else
@server = http.createServer(@onRequest)
@io = socketio.listen(@server, collectedOptions)
@io.sockets.on 'connection', @onConnection
@server.listen @port, cb
createGameProcess = (attributes, server)->
gameProcess = child_process.fork "#{__dirname}/game_process"
gameProcess.on 'message', server.onGameProcessMessage
gameProcess.send type: 'init', game: attributes
gameProcess
class Server
constructor: (attributes={})->
@games = {}
Game = require '../models/game'
game = null
sendGameUpdate = (game)->
process.send
type: 'game'
game: game.toJSON()
sendGameStop = (game)->