Skip to content

Instantly share code, notes, and snippets.

View mediavrog's full-sized avatar

Maik B mediavrog

  • @shackersNFT
  • Germany / Japan
View GitHub Profile
@mediavrog
mediavrog / NetworkUtils.java
Created March 18, 2014 08:54
When adding Authorization header for use with HttpConnection, beware of the WRAPPING. A wrapped Authorization header will always return 401./..
// the flag Base64.NO_WRAP is essential
public String generateBasicAuthString() {
return "Basic " + Base64.encodeToString(String.format("%s:%s", Utils.deobfuscate(BuildConfig.USER), Utils.deobfuscate(BuildConfig.PW)).getBytes(), Base64.URL_SAFE | Base64.NO_WRAP);
}
@mediavrog
mediavrog / gist:9363908
Created March 5, 2014 09:18
Tip: Add a junk object to your possibly leaking Listeners, Activities, whatever to make them spottable easier when MATing
private byte[] junk = new byte[10*1024*1024];
@mediavrog
mediavrog / build.regen_config.gradle
Created February 5, 2014 05:23
Always rebuild / regenerate the BuildConfig file to reflect changes made to buildConfigField
// always rebuild our build config
tasks.whenTaskAdded { task ->
if (task.name ==~ /generate[\w\W]+BuildConfig/) {
task.dependsOn "clean" + task.name.capitalize()
}
}