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
| rm Pods/Manifest.lock && rm Podfile.lock && pod install |
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
| // This is a shortcut for user.friends != nil ? user.friends.count : 0 | |
| let count = user.friends?.count ?? 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
| Add the following line at the 'Arguments Passed On Launch' in your run scheme. | |
| -com.apple.CoreData.SQLDebug 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
| // Var only setteable from private access level but with internal access (default) on its getter | |
| private(set) var info = "" | |
| // Var only setteable from private access level but with public access on its getter | |
| public private(set) var info = "" |
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
| /** | |
| Deletes all the existing files and subdirectories in the NSTemporaryDirectory | |
| */ | |
| + (void)cleanTemporaryDirectory { | |
| NSString *tmpDirectory = NSTemporaryDirectory(); | |
| NSFileManager *fileManager = [NSFileManager defaultManager]; | |
| NSError *error; | |
| NSArray *cacheFiles = [fileManager contentsOfDirectoryAtPath:tmpDirectory error:&error]; | |
| for (NSString *file in cacheFiles) { | |
| error = 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
| /** | |
| Downloads the file from the specified <code>url</code> into the given <code>targetPath</code>. | |
| */ | |
| + (void)downloadFileFromUrl:(NSString *)url targetPath:(NSString *)path success:(void (^)(NSString *filePath))success failure:(void (^)(NSError *error))failure { | |
| NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; | |
| AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; | |
| [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { | |
| NSString *filename = [operation.response suggestedFilename]; | |
| NSString *filePath = [path stringByAppendingPathComponent:filename]; |
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
| po [[[[UIApplication sharedApplication] keyWindow] rootViewController] _printHierarchy] |
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
| #!/bin/bash | |
| # customize with your own. | |
| options=("AAA" "BBB" "CCC" "DDD") | |
| menu() { | |
| clear | |
| echo "Avaliable options:" | |
| for i in ${!options[@]}; do | |
| printf "%3d%s) %s\n" $((i+1)) "${choices[i]:- }" "${options[i]}" |
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 * htmlString = @" <p><b>Hey</b> you. My <b>name </b> is <h1> Joe </h1></p> "; | |
| NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; | |
| UILabel * myLabel = [UILabel alloc] init]; | |
| myLabel.attributedText = attrStr; |