Skip to content

Instantly share code, notes, and snippets.

View gacordeiro's full-sized avatar

Guilherme Cordeiro gacordeiro

View GitHub Profile
@gacordeiro
gacordeiro / Ternary in Kotlin
Last active March 13, 2020 17:17
Ternary in Kotlin
class _Ternary<out T>(val condition: Boolean, val ifTrue: T)
infix fun <T> Boolean.then(ifTrue: T): _Ternary<T> = _Ternary(this, ifTrue)
infix fun <T> _Ternary<T>.otherwise(ifFalse: T): T = if (condition) ifTrue else ifFalse
const val tellMeTheTruth: Boolean = true
val result: String = tellMeTheTruth then "I'll believe you" otherwise "I'll never trust you"
@gacordeiro
gacordeiro / Dagger 2.11 initial setup example
Last active May 14, 2020 01:26
Dagger 2.11 initial setup example
Dagger 2.11 initial setup example