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(^)())facebookImageBlockWithCompletionHandler:(void(^)(id profilePicture, id userInformation, NSError *error))completionHandler | |
{ | |
void(^facebookBlock)()= ^{[FBSession openActiveSessionWithReadPermissions:@[@"basic_info", @"email"] | |
allowLoginUI:YES | |
completionHandler:^(FBSession *session, | |
FBSessionState status, | |
NSError *error) | |
{ | |
if (!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
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated | |
{ | |
[[UIApplication sharedApplication] setStatusBarHidden:NO]; | |
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated: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
Class sportsFeedManager = (Class <RPSportsBoundryProtocol>)[RPInteractor sportsFeedManager]; | |
[sportsFeedManager yahooSportsFeedWithCompletion:^(NSArray *sportsFeeds, NSError *error) | |
{ | |
if (error) | |
{ | |
// TODO: Handle the error; | |
} | |
else | |
{ |
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 SwizzleClassMethod(Class c, SEL orig, SEL new) { | |
Method origMethod = class_getClassMethod(c, orig); | |
Method newMethod = class_getClassMethod(c, new); | |
c = object_getClass((id)c); | |
if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) | |
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); | |
else |
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)parseLoginData:(NSData *)responseData withCompletionBlock:(MJDataSourceCompletionBlock)completionBlock | |
{ | |
[self parseData:responseData withCompletionBlock:^(id response, MJError *error) | |
{ | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) | |
{ | |
MJLoginResponse *loginResponse = [[MJLoginResponse alloc] initWithLoginResponse:response]; | |
dispatch_async(dispatch_get_main_queue(), ^(void) | |
{ |
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
CAAnimationGroup *animationsGroup = [CAAnimationGroup animation]; | |
CATransition *t = [CATransition animation]; | |
t.type = kCATransitionPush; | |
t.subtype = kCATransitionFromRight; | |
t.duration = 1.0f; | |
id currentContents = _layer.contents; | |
_layer.contents = (id)([UIImage imageNamed:@"image2.jpg"].CGImage); | |
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 goal is to make a server call every 5 minutes, but I want to make sure the user has at least moved 500 meters, how would go after this: | |
[RACObserve(self, userLocation) filter:^BOOL(CLLocation *newLocation) | |
{ | |
return [newLocation distanceFromLocation:self.userLocation]>APH500Meters; | |
}]; | |
// I was thinking on creating a scheduler so I got this: | |
RACScheduler *scheduler = [RACScheduler schedulerWithPriority:RACSchedulerPriorityDefault]; |
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
#import <objc/runtime.h> | |
@implementation NSDictionary (Swizzled) | |
static void swizzInstance(Class class, SEL originalSel, SEL newSel) | |
{ | |
Method origMethod = class_getInstanceMethod(class, originalSel); | |
Method newMethod = class_getInstanceMethod(class, newSel); | |
method_exchangeImplementations(origMethod, newMethod); |
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
Pod::Spec.new do |s| | |
s.name = "ReactiveCocoa" | |
s.version = "2.3" | |
s.summary = "A framework for composing and transforming streams of values." | |
s.homepage = "https://github.com/blog/1107-reactivecocoa-is-now-open-source" | |
s.author = { "Josh Abernathy" => "josh@github.com" } | |
s.source = { :git => "https://github.com/ReactiveCocoa/ReactiveCocoa.git", :tag => "v#{s.version}" } | |
s.license = 'MIT' | |
s.description = "ReactiveCocoa (RAC) is an Objective-C framework for Functional Reactive Programming. It provides APIs for composing and transforming streams of values." | |
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 calculations are coming from [here](https://gist.github.com/d-ronnqvist/11266321) (thanks David!) | |
- (void)updateAnimations | |
{ | |
CGFloat duration = self.duration * (1.f - [[self.progressLayers firstObject] strokeEnd]); | |
CGFloat strokeEndFinal = 1.f; | |
for (CAShapeLayer *progressLayer in self.progressLayers) | |
{ | |
POPBasicAnimation *popEndAnimation = [POPBasicAnimation animation]; |
OlderNewer