Skip to content

Instantly share code, notes, and snippets.

View Nilhcem's full-sized avatar

Gautier MECHLING Nilhcem

View GitHub Profile
@Nilhcem
Nilhcem / gist:6f00b08f7c5cda269759
Created March 9, 2015 12:39
Automatically sync your data into truecrypt containers
#!/bin/sh
# Synchronize files into truecrypt containers using tcplay
DROPBOX_FOLDER="/home/USER_NAME/Dropbox/"
CONTAINER_PASSWORD="YOUR_TRUECRYPT_PASSWORD"
MOUNT_DIR="/tmp/backup_dropbox.tc"
MOUNT_OPTS="nodev,nosuid,rw,noatime,umask=000,uid=0,gid=0"
MAPPING_NAME="dropbox.tc"
RSYNC_BIN="/usr/bin/rsync"

#[Tutorial] Android unit testing with Gradle, Robolectric, Dagger and Mockito Not long ago I faced the problem of setting up Gradle, Robolectric and Dagger for unit testing my app. And after tinkering a bit, I managed to make them all work together. In this tutorial I assume that you know how to work with Gradle, Robolectric, Dagger and Mockito separately.

I'm just going to show that they can work together pretty neatly, and how can they make Android testing a lot easier ##Wiring Robolectric and Gradle First of all, you're going to need a fully set up Android project ready to be built with Gradle. And I'm assuming that you're using default project layout (e.g. your java sources are located in $projectDir/src/main/java/)

For the next step we need to install a [Gradle Android test plugin][1] to a local maven repository:

Set up Robolectric with Gradle

  1. Open your top level build.gradle file.

  2. Add Sonatype repo to buildscript repositories and Square Gradle Android Test Plugin to buildscript dependencies. (Older Gradle projects may automatically put this buildscript code in your project build.gradle, in which situation you should put the following in that file.)

@Nilhcem
Nilhcem / com.partycv error
Created February 25, 2013 14:26
Got this after I tried 3 times my linkedin password (could not remember it the first 2 times.) at last it worked, but app crashed just after. Otherwise great idea - I was actually planning to create an Android app resume similar to the one you made previously - I think it will be very instructing. Will you release the sources?
E/AndroidRuntime( 9811): FATAL EXCEPTION: main
E/AndroidRuntime( 9811): java.lang.RuntimeException: Could not dispatch event: class com.partycv.event.ProfileLoadedEvent to handler [EventHandler public void com.partycv.DisplayCvActivity.onProfileUpdated(com.partycv.event.ProfileLoadedEvent)]
E/AndroidRuntime( 9811): at com.squareup.otto.Bus.dispatch(Bus.java:370)
E/AndroidRuntime( 9811): at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:352)
E/AndroidRuntime( 9811): at com.squareup.otto.Bus.post(Bus.java:322)
E/AndroidRuntime( 9811): at com.partycv.LinkedInClient$5.onSuccess(LinkedInClient.java:189)
E/AndroidRuntime( 9811): at com.partycv.LinkedInClient$5.onSuccess(LinkedInClient.java:1)
E/AndroidRuntime( 9811): at com.partycv.AsyncHandler$2.run(AsyncHandler.java:53)
E/AndroidRuntime( 9811): at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime( 9811): at android.os.Handler.dispatchMessage(Handler.java:92)