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
User.transactAndSave(userid, function(user) { | |
// Q chain here | |
}, function(err, user) { | |
}); |
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
if(request.args.game_id === undefined) { | |
var foo = undefined; | |
Game.transactById(request.args.game_id, function(err, game) { | |
foo = game.participantDiscards(request.getUserId(), request.args.card_id_array); | |
}, function(err, game) { |
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
THE PROBLEM: | |
A game server deals hands of cards to each player in a multi-player game. | |
The ideal user experience is for players to be able to play multiple | |
games (with random opponents) and not be dealt repeated cards until | |
they have seen most of the cards in the deck. | |
CONDITIONS: | |
1. Each card has a unique id. |
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)_getProductsById:(NSSet *)productIDs | |
{ | |
NSAssert(self.requestingProducts, @"Should be busy from previous method (getProductsWithCompletion)"); | |
NSAssert(self.productRequest == nil, @"logic"); | |
EALog(@"Getting items: %@", productIDs); | |
SKProductsRequest *productRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIDs]; | |
[productRequest setDelegate:self]; |
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 post_options = { | |
host: 'https://buy.itunes.apple.com', | |
port: '80', | |
path: '/verifyReceipt', | |
method: 'POST', | |
// headers: { | |
// 'Content-Type': 'application/x-www-form-urlencoded', | |
// 'Content-Length': bodyData.length | |
// } |
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
+ (id) objectFromJSONData:(NSData *)data error:(NSError **)error { | |
Class serializer; | |
// try SBJson first | |
serializer = NSClassFromString(@"SBJsonParser"); | |
if (serializer) { | |
id parser; | |
id object; | |
parser = [[serializer 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
var cluster = require('cluster'), | |
redis = require("socket.io/node_modules/redis"), | |
numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
//master process - fork children | |
for (var i = 0; i < numCPUs; i++) { | |
cluster.fork(); | |
} |
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
/** | |
THE PROBLEM: | |
NSDictionary *d = [sever getMeta]; | |
// d.score returns something of type 'NSArray' | |
NSNumber *userId = [d objectForKey:@"score"]; | |
NSInteger i = [userId integerValue]; // <<------- Now what happens! |
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
Evil Apples is hiring! | |
=== HOORAY === | |
Our App has over 250,000 downloads and at any given moment a TON of socket connections. | |
We are a Top 5 Word Game and Top 100 Game in the Apple App Store! | |
We are getting more and more attention every day so it is time to find a Node guru to | |
take charge. A wizard or Jedi is also acceptable. | |
No sorcerers. We don't trust sorcerers. |
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
@implementation UIDevice (EAAdditions) | |
+ (BOOL)isFourInch | |
{ | |
static dispatch_once_t onceToken; | |
static BOOL itIs = NO; | |
dispatch_once(&onceToken, ^{ | |
CGRect screenBounds = [[UIScreen mainScreen] bounds]; | |
if (screenBounds.size.height == 568) { | |
itIs = YES; |