This file contains hidden or 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 { | |
| [super viewDidLoad]; | |
| RAC(self.loginButton, enabled) = [RACSignal combineLatest:@[ | |
| self.usernameTextField.rac_textSignal, | |
| self.passwordTextField.rac_textSignal] | |
| reduce:^(NSString *username, NSString *password) { | |
| return @([username length] > 0 && [password length] > 0); | |
| }]; | |
This file contains hidden or 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 { | |
| [super viewDidLoad]; | |
| RAC(self.nameLabel, text) = RACAble([GHDataStore sharedStore], client.user.name); | |
| RAC(self.emailLabel, text) = RACAble([GHDataStore sharedStore], client.user.email); | |
| RAC(self.companyLabel, text) = RACAble([GHDataStore sharedStore], client.user.company); | |
| RAC(self.loginLabel, text) = RACAble([GHDataStore sharedStore], client.user.login); | |
| RAC(self.reposLabel, text) = [[RACSignal combineLatest:@[ | |
| RACAble([GHDataStore sharedStore], client.user.publicRepoCount), | |
| RACAble([GHDataStore sharedStore], client.user.privateRepoCount) |
This file contains hidden or 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
| // get user settings | |
| SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); | |
| boolean doUpdates = sharedPref.getBoolean(SettingsActivity.UPDATES_KEY, true); | |
| boolean doRally = sharedPref.getBoolean(SettingsActivity.RALLY_KEY, true); | |
| boolean doLeads = sharedPref.getBoolean(SettingsActivity.LEAD_KEY, true); | |
| // subscribe to channels based on user settings | |
| if (doUpdates) PushService.subscribe(this, Update.UPDATES_NOTIFICATION_KEY, UpdatesDetail.class); | |
| if (doRally) PushService.subscribe(this, Update.RALLY_NOTIFICATION_KEY, UpdatesDetail.class); | |
| if (doLeads) PushService.subscribe(this, Update.LEAD_NOTIFICATION_KEY, UpdatesDetail.class); |
This file contains hidden or 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
| #!/bin/bash | |
| # ex: | |
| # coloroverlay black | |
| # coloroverlay 'rgba\\(0,0,0,0.5\\)' | |
| COLOR=$1 | |
| ls *.png | awk '{print("convert "$1" \\( -clone 0 -fill '$COLOR' -draw \"color 0,0 reset\" \\) -compose atop -composite "$1)}' | /bin/sh |
This file contains hidden or 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
| - (NSManagedObjectContext *)managedObjectContext { | |
| if (! _managedObjectContext) { | |
| NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"Moviedo" withExtension:@"momd"]; | |
| NSManagedObjectModel *managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; | |
| _managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; | |
| _managedObjectContext.persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel]; | |
| NSURL *storeURL = [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] URLByAppendingPathComponent:@"Moviedo.sqlite"]; | |
| NSDictionary *options = @{ |
This file contains hidden or 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 Foundation | |
| import ImageIO | |
| func datesFromImagesInDir(dir: String) -> [NSDate] { | |
| let fm = NSFileManager.defaultManager() | |
| var error: NSError? | |
| let df = NSDateFormatter() | |
| df.dateFormat = "yyyy:MM:dd HH:mm:ss" |
This file contains hidden or 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
| func showScheme(sender: ScalingPageControl) { | |
| performSegueWithIdentifier(SegueIdentifier.PresentSchemeSegue.rawValue/* :( */, sender: pageControl) | |
| } |
This file contains hidden or 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
| #!/bin/sh | |
| # Example usage | |
| # cd into directory that has @3x images | |
| # ./whatever-you-name-this.sh | |
| # Remember to chmod +x the script | |
| resize () { | |
| ls *@3x.png | awk '{print("convert "$1" -filter box -resize '$1' "$1)}' | sed 's/@3x/'$2'/2' | /bin/sh | |
| } |
This file contains hidden or 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
| // | |
| // RN3DTouchGestureRecognizer.swift | |
| // | |
| // Created by Ryan Nystrom on 10/10/15. | |
| // Copyright © 2015 Ryan Nystrom. All rights reserved. | |
| // | |
| import UIKit.UIGestureRecognizerSubclass | |
| class RN3DTouchGestureRecognizer: UIGestureRecognizer { |
This file contains hidden or 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
| // iterate newResultsArray in ascending order | |
| // if na[i] == oa[j] and na[i+1] == oa[j+1], assign them to the opposite index+1 | |
| // pass 4 is for ascending and 5 descending, block covers logic for both | |
| void (^pass4And5Block)(BOOL, vector<IGListRecord>&, vector<IGListRecord>&) = ^(BOOL ascending, vector<IGListRecord> &newResults, vector<IGListRecord> &oldResults) { | |
| const NSInteger offset = ascending ? 1 : -1; | |
| for (NSInteger i = ascending ? 0 : newCount - 1; | |
| (ascending && i < newCount - 1) || (!ascending && i > 0); | |
| ascending ? i++ : i--) { | |
| // don't check block moves for new elements |