Skip to content

Instantly share code, notes, and snippets.

View lemonkey's full-sized avatar
🏠
Working from home

Ari Braginsky lemonkey

🏠
Working from home
View GitHub Profile
@lemonkey
lemonkey / fix_keyrepeat_rate.sh
Created March 17, 2018 16:53
macOS: fix keyboard repeat rate
#!/bin/bash
# 20180315
# https://apple.stackexchange.com/questions/10467/how-to-increase-keyboard-key-repeat-rate-on-os-x
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
@lemonkey
lemonkey / xcode-user-breakpoints.xml
Created November 9, 2017 19:19
Xcode User Breakpoints 20171109
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.SymbolicBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
@lemonkey
lemonkey / property.m
Created October 28, 2016 18:14 — forked from quellish/property.m
Managed object property access
[[managedObject managedObjectContext] performBlock:^{
NSString *value = [managedObject someValue];
[NSOperationQueue mainQueue] addOperationWithBlock:^{
[[self label] setText:value];
}];
}];
@lemonkey
lemonkey / save.m
Created October 28, 2016 18:14 — forked from quellish/save.m
Save
[managedObjectContext performBlock:^{
NSError *error = nil;
if (![managedObjectContext save:&error]){
[self handleError:error];
}
}];
@lemonkey
lemonkey / allPeopleInManagedObjectContext.m
Created October 28, 2016 18:13 — forked from quellish/allPeopleInManagedObjectContext.m
allPeopleInManagedObjectContext
- (void) allPeopleInManagedObjectContext:(NSManagedObjectContext *)managedObjectContext withCompletion:(void (^)(NSArray*, NSError*))completion {
[managedObjectContext performBlock:^{
NSError *error = nil;
NSArray *results = nil;
NSFetchRequest *fetchRequest = nil;
NSPredicate *predicate = nil;
NSEntityDescription *entity = nil;
fetchRequest = [[NSFetchRequest alloc] init];
entity = [NSEntityDescription entityForName:@"Person" inManagedObjectContext:context];
@lemonkey
lemonkey / saveManagedObjectContext.m
Created October 28, 2016 01:17 — forked from quellish/saveManagedObjectContext.m
Recursive save of managed object context
- (void) saveManagedObjectContext:(NSManagedObjectContext *)managedObjectContext withCompletion::(void (^)(BOOL, NSError *))completio{
managedObjectContext performBlock:^{
NSError *error = nil;
if (![managedObjectContext save:&error]){
completion(NO, error);
} else {
if ([managedObjectContext parentContext] != nil){
[self saveManagedObjectContext:[managedObjectContext parentContext] withCompletion:completion];
} else {
@lemonkey
lemonkey / waitForBlock.m
Created October 28, 2016 01:14 — forked from quellish/waitForBlock.m
Pseudo-sample of synchronous use of Core Data performBlock: using dispatch group
group = dispatch_group_create();
dispatch_group_enter(group);
[context performBlock:^{
result = [context executeFetch:...
dispatch_group_leave(group);
}];
groupResult = dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
@lemonkey
lemonkey / fetchThingsWithCompletion.m
Created October 28, 2016 01:13 — forked from quellish/fetchThingsWithCompletion.m
Pseudo-sample of a core data fetch with a completion block.
- (void) fetchThingsWithCompletion:(void (^)(NSArray *, NSError *))completion{
[context performBlock:^{
result = [context executeFetch:...
if (completion != nil){
completion(result, error);
}
}];
}
@lemonkey
lemonkey / gist:cc9d807a7b6ecd0cac33
Created January 19, 2016 20:04
MH: Adding Swift Support to hAPITracker key milestones
* 001: Upgrade to CocoaPods v0.39 and fix custom post install steps in Podfiles, etc. (Mon 11/16) (Wed 11/18)
* 002: Add use_frameworks! to hAPITracker and SS Podfile and investigate problems (Mon 11/16) (Thu 11/19)
* 003: Upgrade 3rd party dependencies as needed (Wed 11/18) (Thu 11/26)
* 004: Create new blank hAPITrackerFramework using Cocoa Touch Framework Xcode project (Thu 11/19) (Thu 11/19)
* 005: Turn hAPITrackerFramework into a CocoaPod that is used as a local dev pod only (no specs repo) (Thu 11/19) (Thu 11/19)
* 006: Create new blank iOS app that has hAPITrackerFramework as a dependency, with use_frameworks! (Thu 11/19) (Thu 11/19)
* 007: Add a unit test to hAPITrackerFramework and make sure it can run (Thu 11/19) (Thu 11/19)
* 008: Add a unit test to new blank iOS app and make sure it can run (Thu 11/19) (Thu 11/19)
* 009: Add all 3rd party pods to hAPITrackerKit (Fri 11/20) (Thu 11/26)
* 010: Add static libraries and source from libs folder from existing hAPITracker to new framework (TN, Google Ana
@lemonkey
lemonkey / podinstall-after_classes.log
Last active November 23, 2015 00:03
pod install log for https://github.com/CocoaPods/CocoaPods/issues/4570, after sample classes added to Pod1 and Pod2 Cocoa Touch Frameworks
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods`: (``)
Using `ARCHS` setting to build architectures of target `Pods-Main`: (``)
Using `ARCHS` setting to build architectures of target `Pods-MainTests`: (``)
Finding Podfile changes
- Pod1
- Pod2