Skip to content

Instantly share code, notes, and snippets.


Guillaume Legrand desseim

View GitHub Profile
desseim / ExampleInjectedActivity.kt
Last active Oct 7, 2015
Injection in >= M14 Kotlin code with Dagger2
View ExampleInjectedActivity.kt
class ExampleInjectedActivity : Activity() {
@Inject lateinit var controller: ExampleController
override fun onCreate(savedInstanceState: Bundle?) {
//controller.doThing() // would compile but throw at runtime
desseim / gist:914e0663bee3f20d6ca0
Created Jan 7, 2015
Create a new git repo out of only a sub-directory of an existing repo
View gist:914e0663bee3f20d6ca0
# clone the original repo
git clone
cd ./repo
# filter all git history (including all branches) and only keep the commits affecting a given subdirectory
git filter-branch --subdirectory-filter the/sub/dir -- --all
# clean up git backups (only necessary to help making sure all that we don't want is gone afterwards):
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
desseim / gist:0ea3438ea99c8a6e8a77
Last active Aug 29, 2015
Gradle dependency configuration for injected tests using mockito, dagger, guava and auto with Android
View gist:0ea3438ea99c8a6e8a77

This is the configuration I used to get the tests for my Android project to run. This works with Android Studio 0.8 (Gradle 1.12).

The project uses notably guava, mockito, dagger, assertj, awaitility, auto, retrofit / okhttp and mockwebserver and also needs to inject some tests with test-specific modules. Given the necessity to inject tests and the current lack of support for transitive dependencies for the androidTestXxx scopes, the dependency settings are somewhat tricky to get to work properly.

compile ''
compile ''
compile ''