Skip to content

Instantly share code, notes, and snippets.

View grantland's full-sized avatar

Grantland Chew grantland

View GitHub Profile
@grantland
grantland / gist:1068362
Created July 6, 2011 21:25 — forked from jamiebriant/gist:452213
Fix for categories in static libraries requiring -all_load/-force_load
diff --git a/Build/Products/three20/Three20/.fix b/Build/Products/three20/Three20/.fix
new file mode 100644
index 0000000..e69de29
diff --git a/Build/Products/three20/Three20Core/.fix b/Build/Products/three20/Three20Core/.fix
new file mode 100644
index 0000000..e69de29
diff --git a/Build/Products/three20/Three20Network/.fix b/Build/Products/three20/Three20Network/.fix
new file mode 100644
index 0000000..e69de29
diff --git a/Build/Products/three20/Three20Style/.fix b/Build/Products/three20/Three20Style/.fix
@grantland
grantland / gist:1096474
Created July 21, 2011 04:09
Android Activity Lifecycle
[...] = starting state
States:
not running (dead)
onResume (running)
onStop (minimized)
onPause (screen off)
Launch Application:
@grantland
grantland / gist:1201810
Created September 7, 2011 21:31
iOS Keychain
standardUserDefaults stores information in a plist file in plain text
To find it:
cd /User/Applications/
grep <app name> *
/User/Applications/<random string>/Library/Preferences/<bundle id>.plist
@grantland
grantland / gist:1201813
Created September 7, 2011 21:32
Android SharedPreferences
SharedPreferences information in a xml file in plain text
to find it:
/data/data/<package>/shared_prefs/
generally default.xml but may be another file
@grantland
grantland / gist:1255027
Created September 30, 2011 21:33
ANDROID_ID
/data/data/com.android.providers.settings/databases/settings.db
select * from secure where name='android_id'
@grantland
grantland / README.md
Created October 8, 2012 21:42
iOS NSURLCache bug

NSURLCache uses more than just the HTTP method and URL properties of NSURLRequest as the key for its cache. Therefore, it is possible for a request with method=GET and URL=X to return a miss with NSURLCache even though a NSCachedURLResponse was stored with method=GET and URL=X. These misses can be caused by non-http properties of NSURLRequest being different than the NSURLRequest used to store the NSCachedURLResponse.

We've seen the following show up as a miss:

NSURLCache * cache = //...    
NSURL *url = [NSURL URLWithString:@"http://example.com"];
NSURLRequestCachePolicy cachePolicy = NSURLRequestReturnCacheDataElseLoad;
NSURLRequest r1 = [NSURLRequest requestWithURL:url cachePolicy:cachePolicy timeoutInterval:30];
NSURLRequest r2 = [NSURLRequest requestWithURL:url cachePolicy:cachePolicy timeoutInterval:60];
@grantland
grantland / gist:3949145
Created October 24, 2012 21:50
Fix for "Dx warning: Ignoring InnerClasses attribute for an anonymous inner class"
To fix the following warning, you must add "-keepattributes EnclosingMethod" to your proguard config.
Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(me.kiip.internal.c.h) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
@grantland
grantland / gist:3989521
Created October 31, 2012 20:12
Printing stack traces in iOS 5+
// source: http://stackoverflow.com/questions/7841610/xcode-4-2-debug-doesnt-symbolicate-stack-call
void uncaughtExceptionHandler(NSException *exception) {
NSLog(@"CRASH: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
// Internal error reporting
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
@grantland
grantland / gist:5464067
Last active September 26, 2017 15:49
Enabling Auto-Rotate Quick Settings Toggle on Phones

Android Development

Gradle

Enable Gradle Daemon

Speed up Gradle build times by enabling the Gradle Daemon

echo org.gradle.daemon=true >> ~/.gradle/gradle.properties