Skip to content

Instantly share code, notes, and snippets.

View doridori's full-sized avatar

Dorian Cussen doridori

View GitHub Profile
@doridori
doridori / DaggerHelper.java
Last active May 14, 2022 10:01
Testing with Dagger, Retrofit & MockWebServer gists
/**
* Allows easy swapping of production and test modules to satisfy Dagger dependencies
*/
public class DaggerHelper
{
//DAGGER
private static ObjectGraph sObjectGraph;
private static final List<Object> productionModules;
@doridori
doridori / reduce.kt
Last active January 20, 2023 19:30
Application as a function blog post code
fun reduce(action: Action, state: State): Effect
@doridori
doridori / explicit_iv.java
Last active September 14, 2023 14:24
Beware of the default IV blog post example
public byte[] encrypt(byte[] in)
{
...
byte[] iv = new byte[IV_LENGTH];
new SecureRandom().nextBytes(iv);
cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(iv));
byte[] cipherBytes = cipher.doFinal(s.getBytes("UTF-8"));
return concat(iv, cipherBytes);
}
@doridori
doridori / build.gradle
Last active April 1, 2024 21:48
Incrementing android VersionCode via gradle
//in your root build.gradle
//--------- Version Increment ----------//
//can call this like `./gradlew incrementVersionCode build`
task incrementVersionCode {
description = "Increments the version code in the version.properties file"
doLast {
File versionPropsFile = file('version.properties')