Change type enumeration
typedef NS_ENUM(NSUInteger, SZSTextChangeType) {
SZSTextChangeTypeDelete,
SZSTextChangeTypeInsert,
SZSTextChangeTypeReplace
};
import Cocoa | |
import GameplayKit | |
let randoms = NSCountedSet() | |
let shuffles = NSCountedSet() | |
let gausians = NSCountedSet() | |
let randomD3 = GKRandomDistribution(lowestValue: 1, highestValue: 3) | |
let shuffledD3 = GKShuffledDistribution(lowestValue: 1, highestValue: 3) | |
let gausianD3 = GKGaussianDistribution(lowestValue: 1, highestValue: 3) |
1 | |
2 | |
fizz | |
4 | |
buzz | |
fizz | |
7 | |
8 | |
fizz | |
buzz |
import Foundation | |
extension Dictionary { | |
static func keyDifference<Value: Equatable>(dictionary1 dic1: Dictionary<Key, Value>, dictionary2 dic2: Dictionary<Key, Value>, inout inserted: Set<Key>, inout deleted: Set<Key>, inout updated:Set<Key>, inout unchanged: Set<Key>) { | |
let keys1 = Set(dic1.keys.array) | |
let keys2 = Set(dic2.keys.array) | |
let allKeys = keys1.union(keys2) | |
inserted = [] |
- (UIView *)view { | |
[self loadViewIfRequired]; | |
return _existingView; | |
} | |
- (void)loadViewIfNeeded { | |
[self loadViewIfRequired]; | |
} |
# Adding original repository as a fork | |
git remote add --track master forked_from git://github.com/user/repo.git | |
# Fetch from remote called forked_from | |
git fetch forked_from | |
# Merging codeabase | |
git merge forked_from/master |
- (AFHTTPRequestOperation *)imageFetchOperationForCategoryWithURL:(NSURL *)URL success:(void(^)(AFHTTPRequestOperation *operation, id response))success failure:(void(^)(AFHTTPRequestOperation *operation, NSError *error))failure | |
{ | |
static NSString *categoriesCacheDirectory; | |
static NSCache *inMemoryCache; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
inMemoryCache = [[NSCache alloc] init]; | |
categoriesCacheDirectory = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]; | |
categoriesCacheDirectory = [categoriesCacheDirectory stringByAppendingPathComponent:@"location_icons"]; |
Change type enumeration
typedef NS_ENUM(NSUInteger, SZSTextChangeType) {
SZSTextChangeTypeDelete,
SZSTextChangeTypeInsert,
SZSTextChangeTypeReplace
};
- (void)_perform:(id)sender { | |
NSString *identifier = self.destinationViewControllerIdentifier; | |
UIViewController *sourceViewController = self.viewController; | |
UIStoryboard *storyboard = sourceViewController.storyboard; | |
UIViewController *destinationViewController = [storyboard instantiateViewControllerWithIdentifier:identifier]; | |
UIStoryboardSegue *segue = [self segueWithDestinationViewController:destinationViewController]; | |
[sourceViewController prepareForSegue:segue | |
sender:destinationViewController]; | |
[segue perform]; | |
} |
# Existent podfile | |
current_directory="${PWD}" | |
current_podfile_path="$current_directory/Podfile" | |
current_directory_md5=`md5 -q -s "$current_directory"` | |
temporary_podfile_path="/tmp/${current_directory_md5}.podfile" | |
echo "Comparing Podfiles\nOld: $current_podfile_path\nNew: $temporary_podfile_path" | |
# Comparing it to the new Podfile | |
comparison_result=`comm -1 -3 -i $current_podfile_path $temporary_podfile_path` |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |