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
__block XXCurrentUser * user = nil; | |
dispatch_group_t group = dispatch_group_create(); | |
[[XXClient sharedManager] setObserverDidSignInBlock:^(XXAccessCredential *accessCredential, NSError *error) { | |
[[LUKeychainAccess standardKeychainAccess] setObject:accessCredential forKey:NSStringFromClass([self class])]; | |
if(error)theBlock(nil,error); | |
else dispatch_group_leave(group); | |
}]; | |
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
//Hmm lets not clear up the blocks because lol. ~ Seivan. | |
__block XXCurrentUser * user = nil; | |
dispatch_group_t groupRequestMyProfile = dispatch_group_create(); | |
dispatch_group_t groupSaveMyProfile = dispatch_group_create(); | |
dispatch_group_t groupRequestMyApplications = dispatch_group_create(); | |
dispatch_group_t groupRequestMyNotifications = dispatch_group_create(); | |
[[XXClient sharedManager] setObserverDidSignInBlock:^(XXAccessCredential *accessCredential, NSError *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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
[SINavigationControllerAccompanyTransition accompanyFromController:self | |
withNavigationController:self.navigationController]; | |
[self.txtFieldPhoneNumber SH_addControlEvents:UIControlEventEditingChanged withBlock:[ETPhoneHandlers handlePhoneWithController:self]]; | |
[self.txtFieldCountryName SH_setShouldBeginEditingBlock:[ETPhoneHandlers handleCountryWithController: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
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;{ | |
CGFloat heightForRowAtIndexPath = 44.f; | |
NSString * cellID = [self cellIdForIndexPath:indexPath]; | |
UITableViewCell <XXApplicationTableViewCellConfiguring> * cell = [tableView dequeueReusableCellWithIdentifier:cellID]; | |
if([cell conformsToProtocol:@protocol(XXApplicationTableViewCellConfiguring)]) { | |
[cell configureCellWithApplicationModel:self.application]; | |
[cell layoutSubviews]; | |
heightForRowAtIndexPath = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height; | |
} |
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(self.accessCredential.isAboutToExpire) [self refreshToken]; | |
dispatch_group_notify(self.signalWaitingForRefresh, dispatch_get_main_queue(), ^{ | |
[self.apiClient requestWithResourcePath:theResourcePath parameters:theParameters HTTPMethod:theHTTPMethod onComplete:^(NSDictionary *responseObject, NSError *error, NSHTTPURLResponse *HTTPURLResponse) { | |
theBlock(responseObject,error, HTTPURLResponse); | |
}]; | |
}); |
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
-(NSString *)platformsAsOxfordComma; { | |
NSArray * platforms = (NSArray *)self.platforms; | |
return [platforms SH_reduceValue:@"".mutableCopy withBlock:^id(NSMutableString * memo, NSString * obj) { | |
if(platforms.lastObject == obj) { | |
if(platforms.count > 1) [memo appendString:NSLocalizedString(@"AND", nil)]; // Do other languages even work like this? | |
[memo appendString:obj]; | |
} | |
else { | |
[memo appendString:obj]; | |
[memo appendString:@", "]; |
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
self.navigationController.transitioningDelegate = self; | |
[self SH_setAnimationDuration:0.5 withPreparedTransitionBlock:^(UIView *containerView, UIViewController *fromVC, UIViewController *toVC, NSTimeInterval duration, id<SHViewControllerAnimatedTransitioning> transitionObject, SHTransitionAnimationCompletionBlock transitionDidComplete) { | |
if (transitionObject.isReversed) { | |
toVC.view.layer.affineTransform = CGAffineTransformMakeTranslation(-CGRectGetWidth(toVC.view.frame), 0); | |
} | |
else { | |
toVC.view.layer.affineTransform = CGAffineTransformMakeTranslation(CGRectGetWidth(toVC.view.frame), 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
+(instancetype)me; { | |
XXXCurrentUser * me = [XXXCurrentUser MR_findFirst]; | |
[XXXClient sharedManager].accessCredential = [[LUKeychainAccess standardKeychainAccess] | |
objectForKey:NSStringFromClass([self class])]; | |
if(me == nil || [XXXClient sharedManager].accessCredential == nil) { | |
me = nil; |
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
Proper naming | |
completion: for callbacks that are complete (option) | |
completionHandler: callbacks that are complete but need action (required) | |
handler: callbacks that need action but are not necessarily completion (required) |
OlderNewer