Skip to content

Instantly share code, notes, and snippets.


Sash Zats zats

View GitHub Profile
zats / gist:4068316
Created November 13, 2012 20:52
Updating fork from original repository
View gist:4068316
# Adding original repository as a fork
git remote add --track master forked_from git://
# Fetch from remote called forked_from
git fetch forked_from
# Merging codeabase
git merge forked_from/master
zats / gist:5212898
Last active December 15, 2015 05:59
Dynamic category icons – Foursquare approach
View gist:5212898
- (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"];
spot_environment=$(echo "$GCC_PREPROCESSOR_DEFINITIONS" | sed -n 's/^.*ENVIRONMENT=\(.\)/\1/p')
current_facebook_url=$(/usr/libexec/PlistBuddy -c "Print CFBundleURLTypes:0:CFBundleURLSchemes:0" "$info_plist")
zats /
Last active December 25, 2015 23:58
Knowing the nature of text changes, helps to deal with it better.

Change type enumeration

typedef NS_ENUM(NSUInteger, SZSTextChangeType) {
zats / UIStoryboardSegueTemplate.m
Last active January 2, 2016 12:59
Guessed implementation of the `-[UIStoryboardSegueTemplate _perform:]`
View UIStoryboardSegueTemplate.m
- (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
[segue perform];
zats /
Last active January 3, 2016 14:19
Git hook to run pod install automatically upon checkout if Podfile change comparing to the last commit
# Existent podfile
current_directory_md5=`md5 -q -s "$current_directory"`
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`
zats / 0_reuse_code.js
Created January 20, 2014 15:08
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
zats / ZTSCameraControllerHelper.m
Created May 20, 2014 12:18
Fix for ImagePicker's camera resetting [UIApplication sharedApplication].idleTimerDisabled = YES;
View ZTSCameraControllerHelper.m
@interface ZTSCameraControllerHelper ()
@property (nonatomic, assign, getter = isIdleTimerDisabled) BOOL idleTimerDisabled;
@implementation ZTSCameraControllerHelper
+ (instancetype)sharedInstance {
static ZTSCameraControllerHelper *instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
zats / gist:bc3083faf59926476392
Last active August 29, 2015 14:01
Random kitten as a debugQuickLookObject
View gist:bc3083faf59926476392
- (id)debugQuickLookObject {
NSUInteger width = 100 + (([self hash] >> 4) & 0xFF);
NSUInteger height = 100 + (([self hash] >> 8) & 0xFF);
return [NSURL URLWithString:[NSString stringWithFormat:@"", width, height]];
View gist:7a957e72b63f4f6333ee
id mock = mockClass([NSProcessInfo class]);
[mock processInfo];
[verify(mock) processInfo];