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 | |
# Rename files in dir to slide_##.pdf with two numerals | |
# Exampe filename: UMB_AR App_AN_041515_FA.33.pdf | |
foo = 0 | |
for f in *.pdf | |
do |
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)animate { | |
CABasicAnimation *rotate = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; | |
rotate.byValue = @(M_PI*2); // Change to - angle for counter clockwise rotation | |
rotate.duration = 5.0; | |
rotate.repeatCount = HUGE_VALF; //rotates infinitely. Can be finite value. | |
[self.view.layer addAnimation:rotate forKey:@"myRotationAnimation"]; | |
} |
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
// ViewController.h | |
@interface ViewController : UIViewController | |
@property(nonatomic, strong) NSArray *assets; | |
@end | |
// |
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
@protocol NavBarDelegate <NSObject> | |
@optional | |
- (void)changeDashboardButton :(NSString*)fromSegue; | |
@end | |
@property (nonatomic,strong) id<NavBarDelegate> navbarDelegate; |
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
- (BOOL)validateEmail:(NSString *)emailStr { | |
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; | |
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; | |
return [emailTest evaluateWithObject:emailStr]; | |
} |
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
(NSString*)ratingFunction(int):rating{ | |
int halfStars = rating - floor(rating); | |
int fullStars = floor(rating); | |
NSString *rateString; | |
while(fullStars > 0){ | |
rateString = [rateString stringByAppendingString:@"*"; | |
fullStars --; | |
} |
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 { | |
NSManagedObjectContext *context = nil; | |
id delegate = [[UIApplication sharedApplication] delegate]; | |
if ([delegate performSelector:@selector(managedObjectContext)]) { | |
context = [delegate managedObjectContext]; | |
} | |
return context; | |
} |
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
//Saving data with Core Data | |
-(void)saveLocationData:(double)lat :(double)lon :(NSString*)name { | |
NSManagedObjectContext *context = [self managedObjectContext]; | |
NSManagedObject *locationData = [NSEntityDescription insertNewObjectForEntityForName:@"Location" inManagedObjectContext:context]; | |
[locationData setValue:[NSNumber numberWithDouble:lat] forKey:@"latitude"]; | |
[locationData setValue:[NSNumber numberWithDouble:lon] forKey:@"longitude"]; | |
[locationData setValue:name forKey:@"name"]; | |
NSError *error = nil; |
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]; | |
[self becomeFirstResponder]; // set this view as first responder | |
} | |
-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { | |
if(event.type == UIEventSubtypeMotionShake){ | |
NSLog(@"SHAKE"); | |
} |
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
for (id key in dictionaryName) { | |
// NSLog(@"key: %@ value: %@", key, [dictionaryName objectForKey:key]); | |
} |