Skip to content

Instantly share code, notes, and snippets.

View ashtom's full-sized avatar
:octocat:
the job is not to know; it's to become

Thomas Dohmke ashtom

:octocat:
the job is not to know; it's to become
View GitHub Profile
# Size of preview images for Safari's top sites / history
du -ch {~/Library/Caches/,`getconf DARWIN_USER_CACHE_DIR`}com.apple.Safari
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:nil error:&error]) {
if ([error code] == NSPersistentStoreIncompatibleVersionHashError) {
NSLog(@"Persistent Store Incompatible Version error. Please check %@", storeUrl);
} else {
NSLog([error description]);
}
}
// How to encode NSData for a HTTP request
NSString *dataString = [[NSString alloc] initWithFormat:@"%@", someData];
NSString *dataEncoded = [dataString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"Encoded data = %@", dataEncoded);
// Resetting the application badge number
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];