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
| namespace :utils do | |
| desc "Echos log rotate configs" | |
| task :rotate => :environment do | |
| puts <<EOD | |
| <<<<<<<<<<<<Begin | |
| # Rotate Rails application logs | |
| #{Rails.root}/log/*.log { | |
| daily | |
| missingok | |
| rotate 7 |
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
| NSMutableDictionary *rootObj = [NSMutableDictionary dictionaryWithCapacity:2]; | |
| NSDictionary *innerDict; | |
| NSString *name; | |
| NSDate *dob; | |
| NSArray *scores; | |
| scores = [NSArray arrayWithObjects:[NSNumber numberWithInt:6], | |
| [NSNumber numberWithFloat:4.6], | |
| [NSNumber numberWithLong:6.0000034], | |
| 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)displayValidationError:(NSError *)anError { | |
| NSLog(@"error domain, %@",[anError domain]); | |
| if (anError && [[anError domain] isEqualToString:@"NSCocoaErrorDomain"]) { | |
| NSArray *errors = nil; | |
| // multiple errors? | |
| if ([anError code] == NSValidationMultipleErrorsError) { | |
| errors = [[anError userInfo] objectForKey:NSDetailedErrorsKey]; | |
| } else { | |
| errors = [NSArray arrayWithObject:anError]; |
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/Foundation.h> | |
| #import <CoreData/CoreData.h> | |
| @class Assignment; | |
| @interface Chore : NSManagedObject | |
| @property (nonatomic, retain) NSString * name; | |
| @property (nonatomic, retain) NSNumber * doMonday; | |
| @property (nonatomic, retain) NSNumber * doSunday; |
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
| NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
| [gregorian autorelease]; | |
| NSCalendarUnit unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; | |
| NSDateComponents *component =[gregorian components:unitFlags fromDate:[[NSDate date] addTimeInterval: -86400.0]]; | |
| [component setHour:0]; //12a.m. | |
| [component setMinute:0]; | |
| [component setSecond:1]; | |
| NSDate *yestedayAtMidnight = [gregorian dateFromComponents:component]; |
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
| // | |
| // HelloWorldLayer.mm | |
| // | |
| // Created by Nathan Clark on 10/13/11. | |
| // Copyright self 2011. All rights reserved. | |
| // | |
| // Import the interfaces | |
| #import "HelloWorldLayer.h" |
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)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { | |
| /* Basic setup to translate the tile to gravity */ | |
| b2Vec2 gravity(-acceleration.y * 15, acceleration.x *15); | |
| _world->SetGravity(gravity); | |
| /* First lets figure out the angle to which the iPad is tilted*/ | |
| float angle = atan2(acceleration.x, -acceleration.y); | |
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 "CCPageBox2dBase.h" | |
| @implementation CCPageBox2dBase | |
| @synthesize levelHelperName = _levelHelperName; | |
| - (void)setupWorld { | |
| b2Vec2 gravity = b2Vec2(0.0f, 0.0f); | |
| bool doSleep = false; | |
| _world = new b2World(b2Vec2(0,0), doSleep); |
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
| #include <sys/xattr.h> | |
| /// Set a flag that the files shouldn't be backuped to iCloud. | |
| + (void)addSkipBackupAttributeToFile:(NSString *)filePath { | |
| u_int8_t b = 1; | |
| setxattr([filePath fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0); | |
| } | |
| /// Returns the legacy storage path, used when the com.apple.MobileBackup file attribute is not available. | |
| + (NSString *)legacyStoragePath { |
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
| // If the 1st suffix is not found and if fallback is enabled then fallback suffixes are going to searched. If none is found, it will try with the name without suffix. | |
| // On iPad HD : "-ipadhd", "-ipad", "-hd" | |
| // On iPad : "-ipad", "-hd" | |
| // On iPhone HD: "-hd" | |
| CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils]; | |
| [sharedFileUtils setEnableFallbackSuffixes:NO]; // Default: NO. No fallback suffixes are going to be used | |
| [sharedFileUtils setiPhoneRetinaDisplaySuffix:@"-hd"]; // Default on iPhone RetinaDisplay is "-hd" | |
| [sharedFileUtils setiPadSuffix:@"-ipad"]; // Default on iPad is "ipad" | |
| [sharedFileUtils setiPadRetinaDisplaySuffix:@"-ipadhd"]; // Default on iPad RetinaDisplay is "-ipadhd" | |