Skip to content

Instantly share code, notes, and snippets.

Avatar

Maik B mediavrog

  • @shackersNFT
  • Germany / Japan
View GitHub Profile
@mediavrog
mediavrog / build.regen_config.gradle
Created Feb 5, 2014
Always rebuild / regenerate the BuildConfig file to reflect changes made to buildConfigField
View build.regen_config.gradle
// always rebuild our build config
tasks.whenTaskAdded { task ->
if (task.name ==~ /generate[\w\W]+BuildConfig/) {
task.dependsOn "clean" + task.name.capitalize()
}
}
@mediavrog
mediavrog / gist:9363908
Created Mar 5, 2014
Tip: Add a junk object to your possibly leaking Listeners, Activities, whatever to make them spottable easier when MATing
View gist:9363908
private byte[] junk = new byte[10*1024*1024];
@mediavrog
mediavrog / NetworkUtils.java
Created Mar 18, 2014
When adding Authorization header for use with HttpConnection, beware of the WRAPPING. A wrapped Authorization header will always return 401./..
View NetworkUtils.java
// 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);
}
View dotmatrixforntlink
@mediavrog
mediavrog / .bash_profile
Created Apr 7, 2014
Improved shell for github
View .bash_profile
export ANDROID_HOME=/Applications/AndroidStudio.app/sdk
export PATH=$HOME/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH
source git-completion.bash
# add current git branch to prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[\033[00m\]\u@\h\[\033[01;34m\] \W \[\033[31m\]\$(parse_git_branch) \[\033[00m\]$\[\033[00m\] "
@mediavrog
mediavrog / build.gradle
Created Jul 15, 2014
Simple gradle build file for legacy structure library projects
View build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
@mediavrog
mediavrog / build.gradle
Created Jul 16, 2014
Evernote library build.gradle file
View build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
View CORS_step1.scala
// Create the Global class in your /app folder root package:
import play.api.{GlobalSettings, Play}
import play.api.Play.current
import play.api.mvc._
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
/**
View bound_greeting.js
/*
* Assuming we have some object with properties and methods
*/
var me = {
first_name: 'Ahikar',
last_name: 'Grilka',
race: 'Klingon',
email: 'AhikarGrilka@jourrapide.com',
occupation: 'Commander of Defence',
greet: function(other_person){
View ARAutoRollback.scala
import com.github.aselab.activerecord.{PlayConfig, ActiveRecordTables}
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
import play.api.Play
import play.api.test.FakeApplication
trait ActiveRecordAutoRollback extends BeforeAndAfterEach with BeforeAndAfterAll {
self: ApiBaseSpec =>
def schema: Seq[ActiveRecordTables] = Seq(ActiveRecordTables.find("models.Tables"))