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
function doTap(x, y, numTaps, delay) | |
delay = delay or 16000; | |
local fingerId = 1; | |
for i=numTaps,1,-1 | |
do | |
touchDown(fingerId, x, y); | |
usleep(delay); | |
touchUp(fingerId, x, y); | |
usleep(delay); | |
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
- (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
- (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
- (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
@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
@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
- (void)viewDidLoad { | |
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame: CGRectZero]; | |
self.searchController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self]; | |
self.searchController.delegate = self; | |
// Place it in view | |
searchBar.delegate = self; | |
} | |
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)text { | |
self.searchResults = [self search: text]; |
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 MyViewController < UIViewController | |
def viewDidLoad | |
@search_bar = UISearchBar.alloc.initWithFrame CGRectZero | |
self.navigationController.rac_liftSelector "setNavigationBarHidden:animated:", withSignalsFromArray: [@search_bar.rac_editing, RACSignal.return(true)] | |
# Add search bar to table view, etc. | |
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 UISearchBar (RAC) | |
- (RACSignal *)rac_editing { | |
// Pretend we have an ivar I know we'd use setAssociatedObject | |
_proxy = [[RACDelegateProxy alloc] initWithProtocol: @protocol(UISearchBarDelegate)]; | |
return [@[ | |
[[_proxy signalForSelector: @selector(searchBarTextDidBeginEditing:)] mapReplace: @YES], | |
[[_proxy signalForSelector: @selector(searchBarTextDidEndEditing:)] mapReplace: @NO] | |
].rac_sequence.signal switchToLatest]; | |
} | |
@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
Hash[query.map { |k,v| [k, [v].flatten[0]] }] |
NewerOlder