#Covert Data URI to Blob
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
window.navigator.standalone |
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
for i in `ls`; do mv -f $i `echo $i | sed 's/{match_reg}/{replace_reg}/'`; done |
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
ARC: -fobjc-arc | |
NO-ARC: -fno-objc-arc |
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 drawTriangle(CGContextRef context, CGPoint startPoint, CGPoint secondPoint, CGPoint lastPoint) | |
{ | |
CGContextSaveGState(context); | |
CGContextMoveToPoint(context, startPoint.x, startPoint.y); | |
CGContextAddLineToPoint(context, secondPoint.x, secondPoint.y); | |
CGContextAddLineToPoint(context, lastPoint.x, lastPoint.y); | |
CGContextClosePath(context); | |
CGContextFillPath(context); | |
CGContextRestoreGState(context); |
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 drawCorner(CGContextRef context, CGRect rect, float corner) | |
{ | |
CGContextSaveGState(context); | |
CGContextTranslateCTM(context, CGRectGetMinX(rect), CGRectGetMinY(rect)); | |
CGContextScaleCTM(context, corner, corner); | |
CGFloat fw = CGRectGetWidth(rect) / corner; | |
CGFloat fh = CGRectGetHeight(rect) / corner; | |
CGContextMoveToPoint(context, fw, fh/2); | |
CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1); |
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
#ifdef DEBUG | |
# define DLog(...) NSLog(__VA_ARGS__) | |
#else | |
# define DLog(...) /* */ | |
#endif | |
#define ALog(...) NSLog(__VA_ARGS__) |
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
CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; | |
CGFloat RadiansToDegrees(CGFloat radians) {return radians * 180 / M_PI;}; |
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
#define LAST_LAUNCH_VERSION_KEY @"last_launch_version_of_application" | |
- (BOOL)isFirstLoad | |
{ | |
NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
NSString *lastLaunchVersion = [defaults objectForKey:LAST_LAUNCH_VERSION_KEY]; | |
if (!lastLaunchVersion || ![lastLaunchVersion isEqualToString:currentVersion]) { |
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
//HTTP POST - http://itunes.apple.com/lookup?id={appid} | |
//Result(JSON): | |
{ | |
"resultCount":1, | |
"results": [ | |
{ | |
"kind":"software", |
NewerOlder