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
NSArray *args = [[NSArray alloc] initWithObjects:@"Apple", @"iOS", @"5.1", nil]; | |
NSLog(@"%@", [args componentsJoinedByString:@" "]); |
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
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://www.apple.com"]]; |
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]; | |
[[NSNotificationCenter defaultCenter] | |
addObserver:self | |
selector:@selector(textFieldChanged:) | |
name:UITextFieldTextDidChangeNotification | |
object:toTextField]; | |
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]; | |
NSString *path = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"json"]; | |
NSString *jsonString = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL]; | |
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; | |
NSDictionary *json = [self parseJSON:jsonData]; | |
} |
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 *)escape:(NSString *)text | |
{ | |
return CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes( | |
NULL, | |
(__bridge CFStringRef)text, | |
NULL, | |
CFSTR("!*'();:@&=+$,/?%#[]"), | |
CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding))); | |
} |
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
#!/usr/bin/env bash | |
out/host/linux-x86/bin/mkyaffs2image -f out/target/product/generic/system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img | |
out/host/linux-x86/bin/acp -fpt out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/generic/system.img |
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
- (NSArray *)sortArrayNumberLast:(NSArray *)arr { | |
return [arr sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { | |
NSString *s1 = [obj1 substringToIndex:1]; | |
NSString *s2 = [obj2 substringToIndex:1]; | |
if ([s1 rangeOfCharacterFromSet:[NSCharacterSet decimalDigitCharacterSet]].location == [s2 rangeOfCharacterFromSet:[NSCharacterSet decimalDigitCharacterSet]].location) { | |
return [obj1 compare:obj2]; | |
} else { | |
if ([s1 rangeOfCharacterFromSet:[NSCharacterSet decimalDigitCharacterSet]].location == NSNotFound) { |
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
Show hidden characters
{ | |
"cmd" : ["/bin/sh", "$file"], | |
"selector" : "source.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
wget http://python-distribute.org/distribute_setup.py | |
sudo python distribute_setup.py | |
sudo easy_install -U pip | |
ln -s /Library/Frameworks/Python.framework/Versions/2.7/bin/pip /usr/local/bin/ |