Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Note that like all analogies, this is not a perfect one. I find it helps me think about it though. Also, don't try to draw conclusions about performance from this analogy :)
-[NSUserDefaults setObject:forKey:] is like...
<edit file to add key and value>
git add file
git commit
dispatch_after(some time, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[NSUserDefaults standardUserDefaults] synchronize]
});
-[NSUserDefaults objectForKey:] on 10.9 is like...
git pull --rebase
grep key file
-[NSUserDefaults objectForKey:] on iOS 7 is like...
grep key file
-[NSUserDefaults synchronize] is like...
if (git diff --staged != empty) {
BOOL pushedSuccessfully = NO;
do {
pushedSuccessfully = git push
git pull --rebase
} while (!pushedSuccessfully)
} else {
git pull --rebase
}
Terminating an app normally is like committing your work, pushing, and leaving
Terminating an app abnormally (memory pressure kill, crash, stop in Xcode) is like git reset --hard HEAD, and leaving
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.