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
[self rac_liftSelector:@selector(displayRegion:) | |
withSignals:self.selectedRegion, nil]; |
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
-(void)displayRegion:(WTFRegion *)region { | |
[self.mapView setVisibleMapRect:region.rect animated:YES]; | |
[self.mapView addAnnotations:[self fetchAnnotationsForRegions:region]]; | |
} |
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
[self rac_liftSelector:@selector(doSomethingWithFoo:Bar:Baz:) | |
withSignals:foos, bars, baz, nil]; |
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
-(void)doSomethingWithFoo:(NSString*)aFoo bar:(NSUInteger)aBar baz:(WTFBaz*)baz; |
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
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]]; | |
}]; |
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
RAC(self, 'titleLabel.text') = [self.selectedRegion map:^NSString*(WTFRegion *region) { | |
return region.title; | |
}]; |
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
__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]]; | |
}]; |
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
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 |
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
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 = {} |
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
Game = require '../models/game' | |
game = null | |
sendGameUpdate = (game)-> | |
process.send | |
type: 'game' | |
game: game.toJSON() | |
sendGameStop = (game)-> |