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
| NSFileManager *fileManager = [NSFileManager defaultManager]; | |
| NSError *error; | |
| NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
| NSString *documentsDirectory = [paths objectAtIndex:0]; | |
| NSString *documentDBFolderPath = [documentsDirectory stringByAppendingPathComponent:@"templates"]; | |
| NSString *resourceDBFolderPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"templates"]; | |
| if (![fileManager fileExistsAtPath:documentDBFolderPath]) { | |
| //Create Directory! | |
| [fileManager createDirectoryAtPath:documentDBFolderPath withIntermediateDirectories:NO attributes:nil error:&error]; |
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
| <!DOCTYPE html> | |
| <html lang="en-US" prefix="og: http://ogp.me/ns#"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>{% if is_home %}{{ site.author }}{% elif is_post %}{{ post.title }}{% elif is_link %}{{ link.title }}{% elif is_page %}{{ page.title }}{% endif %} | {{ site.name }}</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <meta name="apple-mobile-web-app-capable" content="yes" /> | |
| <meta name="apple-mobile-web-app-status-bar-style" content="black" /> |
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
| switch (scope) { | |
| case 0: | |
| if (maskTime >= 0) { | |
| // 日出 | |
| if (_ispanGesture) { | |
| _imageLayer0.alpha = ((float)(perTime - abs(maskTime)))/perTime; | |
| _imageLayer1.alpha = 1; | |
| }else{ | |
| [self setimageLayer:_imageLayer0 byAlpha:((float)(perTime - abs(maskTime)))/perTime]; | |
| [self setimageLayer:_imageLayer1 byAlpha:1]; |
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
| const double a = 6378245.0; | |
| const double ee = 0.00669342162296594323; | |
| static BOOL outOfChina(double lat, double lon){ | |
| if(lon < 72.004 || lon > 137.8347){ | |
| return true; | |
| } | |
| if(lat < 0.8293 || lat > 55.8271){ | |
| return true; |
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
| server { | |
| listen 80; | |
| server_name www.mysite.com; | |
| root /path/to/main_site; | |
| # ... | |
| location / { | |
| proxy_set_header X-Real-IP $remote_addr; | |
| # ... |
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
| @interface NSFileManager (DoNotBackup) | |
| - (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL; | |
| @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
| CALayer *capa = [self.navigationController navigationBar].layer; | |
| [capa setShadowColor: [[UIColor blackColor] CGColor]]; | |
| [capa setShadowOpacity:0.85f]; | |
| [capa setShadowOffset: CGSizeMake(0.0f, 1.5f)]; | |
| [capa setShadowRadius:2.0f]; | |
| [capa setShouldRasterize:YES]; | |
| //Round | |
| CGRect bounds = capa.bounds; |
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)pauseLayer:(CALayer*)layer | |
| { | |
| CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil]; | |
| layer.speed = 0.0; | |
| layer.timeOffset = pausedTime; | |
| } | |
| - (void)resumeLayer:(CALayer*)layer | |
| { | |
| CFTimeInterval pausedTime = [layer timeOffset]; | |
| layer.speed = 1.0; |
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
| NSRegularExpression *regex = [NSRegularExpressionregularExpressionWithPattern:@"((@|#)([A-Z0-9a-z(é|ë|ê|è|à|â|ä|á|ù|ü|û|ú|ì|ï|î|í)\u4e00-\u9fa5_]+))|(http(s)?://([A-Z0-9a-z._-]*(/)?)*)" options:NSRegularExpressionCaseInsensitive error:&error]; |
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) jailBreakCheck{ | |
| NSArray *jailbrokenPath = [NSArray arrayWithObjects: | |
| @"/Applications/Cydia.app", | |
| @"/Applications/RockApp.app", | |
| @"/Applications/Icy.app", | |
| @"/usr/sbin/sshd", | |
| @"/usr/bin/sshd", | |
| @"/usr/libexec/sftp-server", | |
| @"/Applications/WinterBoard.app", | |
| @"/Applications/SBSettings.app", |