Skip to content

Instantly share code, notes, and snippets.

Created February 12, 2014 06:32
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8950927 to your computer and use it in GitHub Desktop.
Save anonymous/8950927 to your computer and use it in GitHub Desktop.
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