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
/////// .h /////// | |
// Core Data MOM file: http://grab.by/jf4c | |
// NOTE: Some attributes excluded in the code below | |
@interface CDUserPhotos : NSManagedObject | |
@property (nonatomic, retain) NSData * data; // core data attribute | |
@property (nonatomic, readonly) NSArray* albums; // not an attribute. Calculate from self.data |
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
// TODO: Use weak self to avoid retaining self for a long time (during long downloads) | |
SDWebImageManager *manager = [SDWebImageManager sharedManager]; | |
[manager downloadWithURL:imageURL | |
options:0 | |
progress:nil | |
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) | |
{ | |
if ( [self.imageURL isEqual:imageURL] && | |
image && | |
!error ) |
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
Matchmaking.gameNear = function(user, location, callback) { | |
console.log('[DEBUG] [gameNear]'); | |
Q.fcall(this.updateUserLocation.bind(this,user,location)) // TODO: why do we have to pass 'this' first in bind() params? | |
.then(this.findGamesNearby.bind(this,user,location)) | |
.then(function(games_nearby) { | |
foo(games_nearby); | |
}).done(); | |
}; |
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
/** | |
* question: how can I rewrite lines 8 & 9 to not use an intermediate function? | |
* | |
* | |
*/ | |
Q.fcall(this.findGamesNearby.bind(this,user,location)) | |
.then(function(games_nearby) { | |
return matchmaking.makeGameIfNeeded(games_nearby, user, location); | |
}); |
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
double delayInSeconds = 0.3; | |
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); | |
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | |
NSLog(@"!!!!!!! Go time !!!!!!"); | |
EAForcedUpdateViewController *f = [[EAForcedUpdateViewController alloc] initWithNibName:nil bundle:nil]; | |
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
window.rootViewController = f; | |
// [self.window resignKeyWindow]; | |
// [self.window setHidden:YES]; |
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
// bootstrap! | |
require('../lib/globals.js'); | |
(function() { | |
var HttpServer = require('../lib/http_server.js'); | |
var SocketServer = require('../lib/socket_server.js'); | |
var h = new HttpServer(); | |
var s = new SocketServer(); |
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
shitFinder.findGamesPastDay() | |
.then(shitFinder.printShit()) | |
.done(function (result) { | |
console.log('DONE! res=', result); // logs the result from findGamesPastDay instead of foo | |
process.exit(0) | |
}, function (error) { | |
process.exit(1); | |
}); | |
printShit: function(result) { |
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
/** | |
* NOTE: game.participants contains 3 objects. | |
GOAL: I would like each promise created in lines 31-43 to be executed in serial. | |
I do not want any line of code in drawAnswers() to be called before the previous promise is fulfilled. | |
BUG: The log in drawAnswers() shows me that drawAnswers() is being called 3 times before the | |
1st promise from drawAnswers() is fulfilled. |
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
return Q.fcall(game.makeDeckIfNeeded.bind(game)) | |
.then(game.deck.drawAnswers(participant, cardsToGet)) | |
.then(function(newCards) { | |
// add newcards to hand | |
var newHand = _.union(h,newCards); | |
participant.hand = newHand; | |
return Q.fcall(function() { return game.update(); }); | |
}); |
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
Analyzing dependencies | |
[31m[!] Pod::Executable pull | |
Updating a1d1b07..de42d82 | |
error: Your local changes to the following files would be overwritten by merge: | |
AFKissXMLRequestOperation/0.0.1/AFKissXMLRequestOperation.podspec | |
AdMob/6.4.2/AdMob.podspec |
OlderNewer