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
@interface ApplicationDelegate<UIApplicationDelegate> | |
@end | |
@implementation ApplicationDelegate | |
- (RACSignal *)rac_registeredForRemoteNotifications { | |
RACSignal *signal = objc_getAssociatedObject(self, _cmd); | |
if (signal != nil) return signal; | |
RACSignal *didRegisterForRemoteNotification = [[self rac_signalForSelector: @selector(application:didRegisterForRemoteNotificationsWithDeviceToken:) fromProtocol: @protocol(UIApplicationDelegate)] map: ^(RACTuple *tuple) { | |
return tuple.second; |
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
@form.row(:subform_key).row(:a_row).on_tap |do| | |
end |
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) load { | |
RACSignal *signal = [[api fetchPerson: personId] flattenMap: ^(id person) { | |
return [[[api fetchFamilyMembers: person.id] map: ^(id familyMembers) { | |
return [self buildViewModel: person familyMembers: familyMembers]; | |
}] startWith: [self buildViewModel: person familyMembers: @[]]; | |
}]; | |
} |
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) load { | |
RACSignal* signal = [api fetchPerson: personId]; | |
[signal subscribeNext: ^(id person) { | |
[view renderPerson: person]; | |
}]; | |
[signal subscribeError: ^(NSError *error) { | |
[view renderError]; | |
}]; | |
} |
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)fetchPerson:(NSInteger)personId { | |
[[self fetchAtEndPoint: [NSString stringWithFormat: @"/person/%d", personId], mapTo: [Person class]] flattenMap: ^(id person) { | |
if(!person) { | |
return [RACSignal error: nil]; | |
} else { | |
return [RACSignal return: person]; | |
} | |
}]; | |
} |
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 Car | |
include RequireOptions | |
def go(opts) | |
gear, speed = require_options(opts, :speed, :gear) | |
# ... | |
end | |
end |
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 ConfirmationAlert | |
+ (void)show:(NSString *)message delegate:(id<UIAlertViewDelegate>)theDelegate { | |
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"Confirm" message:message delegate:theDelegate cancelButtonTitle:@"Cancel" otherButtonTitles:@"Confirm", nil] autorelease]; | |
[alertView show]; | |
} | |
@end |
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)showOneConfirmationAlert:(NSMutableDictionary *)externalState { | |
[BlockConfirmationAlert show:@"Are you sure about this?" | |
confirmed:^(UIAlertView *alertView) { | |
//... | |
NSLog([externalState objectForKey:@"Key"]); | |
} | |
canceled:^(UIAlertView *alertView) { | |
//... | |
NSLog([externalState objectForKey:@"DifferentKey"]); | |
}]; |
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 MyObject | |
-(void)showOneConfirmationAlert:(NSMutableDictionary *)externalState { | |
externalStateForOneConfirmationAlert = [externalState retain]; | |
oneConfirmationAlert = [[ConfirmationAlert show:@"Are you sure about this?" delegate:self] retain]; | |
} | |
-(void)showAnotherConfirmationAlert:(NSMutableDictionary *)externalState { | |
externalStateForAnotherConfirmationAlert = [externalState retain]; | |
oneConfirmationAlert = [[ConfirmationAlert show:@"Again, are you sure?" delegate:self] retain]; | |
} |
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
typedef void (^ConfirmationBlock)(UIAlertView *); |
OlderNewer