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 <UIKit/UIKit.h> | |
@interface EmailSubscribeViewController : UIViewController <UITextFieldDelegate> | |
@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
class Queue { | |
var items: Array<AnyObject> = [] | |
// Add an object to the tail of the queue | |
func enqueue(object: AnyObject) { | |
items += object; | |
} | |
// Remove the head of the queue and return the object | |
func dequeue() -> AnyObject? { |
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
// Replace | |
[self.gameTimer invalidate]; | |
self.gameTimer = nil; | |
// With | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self.gameTimer invalidate]; | |
self.gameTimer = nil; | |
}); | |
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
// Replace this line (at line 169 for me but might be different for you) | |
if(self.gameScore == 0) | |
// With this line | |
if(self.gameScore == 0 && !self.gameTimer) |
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
// In MenuViewController.m replace | |
[[GameCenterManager sharedManager] authenticateLocalPlayer]; | |
// With | |
if(kImplementGameCenter) | |
{ | |
[[GameCenterManager sharedManager] authenticateLocalPlayer]; | |
} | |
self.leaderboardButton.hidden = !kImplementGameCenter; | |
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 "ViewController.h" | |
@interface ViewController () | |
@end | |
@implementation ViewController | |
@synthesize strings; | |
- (void)viewDidLoad |
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
[dict enumerateKeysAndObjectsWithOptions:NSEnumerationConcurrent | |
usingBlock:^(id key, id object, BOOL *stop) { | |
NSLog(@"%@ = %@", key, object); | |
}]; |
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
require 'benchmark' | |
array = [] | |
1000.times { | |
array << rand(100) | |
} | |
sort_count = 10_000 | |
default_sort_time = Benchmark.realtime do |
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
# sometimes creates it as .img.dmg if so just mv *.img.dmg to *.img | |
hdiutil convert /path/to/.iso -format UDRW -o /path/to/target.img | |
# determine the mount *generally for me /dev/disk2* | |
diskutil list | |
# unmount the disk where N is the disk number | |
diskutil unmountDisk /dev/diskN | |
# write the img to the usb disk |
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
let uppercaseLetters = Array(65...90).map {String(UnicodeScalar($0))} | |
func randomLetter() -> String { | |
let randomIndex = arc4random_uniform(UInt32(uppercaseLetters.count)) | |
return uppercaseLetters[Int(randomIndex)] | |
} |