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
- (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 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 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 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 "SaveSpot.h" | |
@implementation SaveSpot | |
@synthesize spot = _spot; | |
@synthesize maxSpeedLabel = _maxSpeedLabel; | |
@synthesize avgSpeedLabel = _avgSpeedLabel; | |
@synthesize distanceLabel = _distanceLabel; | |
@synthesize nameTextField = _nameLabel; | |
@synthesize descriptionTextField = _descriptionLabel; |
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
#!/bin/zsh | |
# Compatible with bash, just change "zsh" to "bash" | |
# First param: The folder that the original file is stored in | |
# Second param: The original image name | |
sips --resampleWidth 512 "${1}/${2}" --out "${1}/iTunesArtwork" | |
sips --resampleWidth 57 "${1}/${2}" --out "${1}/Icon.png" | |
sips --resampleWidth 114 "${1}/${2}" --out "${1}/Icon@2x.png" | |
sips --resampleWidth 29 "${1}/${2}" --out "${1}/Icon-Small.png" | |
sips --resampleWidth 58 "${1}/${2}" --out "${1}/Icon-Small@2x.png" |
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
// UIImagePickerController+ImageTypeActionSheet.h | |
@interface UIImagePickerController (ImageTypeActionSheet) | |
- (void)promptImagePickerTypeWithText:(NSString*)text titles:(NSArray*)titles delegate:(id <UIImagePickerControllerDelegate,UINavigationControllerDelegate>)delegate; | |
@end | |
// UIImagePickerController+ImageTypeActionSheet.m | |
@interface ImageTypeActionSheetDelegate : NSObject | |
<UIActionSheetDelegate> |
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 <Foundation/Foundation.h> | |
@interface Hospital : NSObject | |
@property (nonatomic, strong) NSString *name; | |
@property (nonatomic, strong) NSString *address; | |
@property (nonatomic, strong) NSString *city; | |
@property (nonatomic, strong) NSString *county; | |
@property (nonatomic, strong) NSString *state; | |
@property (nonatomic, strong) NSNumber *annualVisitors; | |
@property (nonatomic, strong) NSString *zip; |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// PTMasterController is a subclass of RNSwipeViewController | |
PTMasterController *masterController = [[PTMasterController alloc] init]; | |
PTSchemeController *scheme = [[PTSchemeController alloc] init]; | |
PTUtilityController *utility = [[PTUtilityController alloc] init]; | |
PTWritingController *writing = [[PTWritingController alloc] init]; | |
masterController.centerViewController = writing; | |
masterController.rightViewController = utility; |
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)maskChip { | |
UIGraphicsBeginImageContextWithOptions(self.containerView.bounds.size, NO, [UIScreen mainScreen].scale); | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
CGRect frame = self.containerView.bounds; | |
CGMutablePathRef path = CGPathCreateMutable(); | |
CGPathMoveToPoint(path, NULL, 0, 0); | |
CGPathAddLineToPoint(path, NULL, frame.size.width / 2.f - 6, 0); | |
CGPathAddLineToPoint(path, NULL, frame.size.width / 2.f, 6); | |
CGPathAddLineToPoint(path, NULL, frame.size.width / 2.f + 6, 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
#import <Foundation/Foundation.h> | |
NSMutableURLRequest *parseRequest() { | |
NSMutableURLRequest *request = [[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://api.parse.com/1/classes/YOUR_CLASS_NAME"]] mutableCopy]; | |
[request setValue:@"YOUR_APPLICATION_ID" forHTTPHeaderField:@"X-Parse-Application-Id"]; | |
[request setValue:@"YOUR_REST_API_KEY" forHTTPHeaderField:@"X-Parse-REST-API-Key"]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; | |
[request setHTTPMethod:@"POST"]; | |
return request; |
OlderNewer