Generate the key with no password (just click enter) ssh-keygen -t rsa -b 4096 -C "email@example.com"
Copy to clipboard pbcopy < ~/.ssh/id_rsa.pub
Paste the key to your github account
Allow access ssh -T git@github.com
, say yes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
* Android L (lollipop, API 21) introduced a new problem when trying to invoke implicit intent, | |
* "java.lang.IllegalArgumentException: Service Intent must be explicit" | |
* | |
* If you are using an implicit intent, and know only 1 target would answer this intent, | |
* This method will help you turn the implicit intent into the explicit form. | |
* | |
* Inspired from SO answer: http://stackoverflow.com/a/26318757/1446466 | |
* @param context | |
* @param implicitIntent - The original implicit intent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Log timings per task. | |
class TimingsListener implements TaskExecutionListener, BuildListener { | |
private Clock clock | |
private timings = [] | |
@Override | |
void beforeExecute(Task task) { | |
clock = new org.gradle.util.Clock() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This hack works with com.android.tools.build:gradle:0.2, won't work in later version without modification | |
apply plugin: 'android' | |
targetCompatibility = 1.6 | |
sourceCompatibility = 1.6 | |
android { | |
target = 'android-14' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:1.0.1' | |
// NOTE: Do not place your application dependencies here; they belong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add the version name to the build | |
applicationVariants.all { v -> | |
def f = v.outputFile | |
def fname = f.name.replace(".apk", | |
"-${defaultConfig.versionName}.apk") | |
v.outputFile = new File(f.parent, fname) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.0' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.provider.Settings; | |
import android.util.Base64; | |
import javax.crypto.Cipher; | |
import javax.crypto.SecretKey; | |
import javax.crypto.SecretKeyFactory; | |
import javax.crypto.spec.PBEKeySpec; | |
import javax.crypto.spec.PBEParameterSpec; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void activateStrictModeFull(){ | |
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() | |
.detectAll() | |
.penaltyLog() | |
.build()); | |
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() | |
.detectAll() | |
.penaltyLog() | |
.build()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class UnbindingHelper { | |
/** | |
* Removes the reference to the activity from every view in a view hierarchy (listeners, | |
* images etc.). | |
* This method should be called in the onDestroy() method of each activity | |
* | |
* @param viewID normally the id of the root layout | |
* <p/> | |
* see http://code.google.com/p/android/issues/detail?id=8488 |