Skip to content

Instantly share code, notes, and snippets.

View grantland's full-sized avatar

Grantland Chew grantland

View GitHub Profile
----- pid 1297 at 2015-03-11 19:47:34 -----
Cmd line: system_server
ABI: x86_64
Build type: optimized
Zygote loaded classes=3593 post zygote classes=2212
Intern table: 38395 strong; 1947 weak
JNI: CheckJNI is on; globals=826 (plus 15 weak)
Libraries: /system/lib64/libandroid.so /system/lib64/libandroid_servers.so /system/lib64/libaudioeffect_jni.so /system/lib64/libcompiler_rt.so /system/lib64/libjavacrypto.so /system/lib64/libjnigraphics.so /system/lib64/libmedia_jni.so /system/lib64/librs_jni.so /system/lib64/libsoundpool.so /system/lib64/libwebviewchromium_loader.so /system/lib64/libwifi-service.so libjavacore.so (12)
Heap: 1% free, 10MB/10MB; 148650 objects
@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: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 / hexalter.cpp
Created October 2, 2015 07:07 — forked from Jakz/hexalter.cpp
Simple cmmand line byte modifier that replaces raw bytes inside a given file
#include <stdint.h>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
using namespace std;
struct Patch
{
@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
{

Android Development

Gradle

Enable Gradle Daemon

Speed up Gradle build times by enabling the Gradle Daemon

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