Skip to content

Instantly share code, notes, and snippets.

GuilhE / OperatorExtensions.kt
Last active Mar 21, 2020
Extension class to convert ReactiveX operators into Coroutines
View OperatorExtensions.kt
import kotlinx.coroutines.*
fun throttleClick(scope: CoroutineScope = CoroutineScope(Dispatchers.Main), clickAction: (Unit) -> Unit): (Unit) -> Unit {
return throttleFirst(1_000, scope, clickAction)
* Processes input data and passes the first data to [action] and skips all new data for the next [skipMs].
fun <T> throttleFirst(skipMs: Long = 700L, scope: CoroutineScope = CoroutineScope(Dispatchers.Main), action: (T) -> Unit): (T) -> Unit {
GuilhE / OperatorExtensionsTest.kt
Last active Feb 19, 2020
OperatorExtensions tests with MockK
View OperatorExtensionsTest.kt
import io.mockk.clearAllMocks
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.setMain
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.*
GuilhE / RxExtensions.kt
Created Mar 4, 2020
Helper compose functions for RxKotlin
View RxExtensions.kt
import android.annotation.SuppressLint
import com.blissapplications.kotlin.core.common.threads.ReactivexThreadSchedulerProvider
import io.reactivex.Completable
import io.reactivex.Single
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
* Examples of usage of this extensions functions:
GuilhE / bitbucket-pipelines.yml
Last active Feb 3, 2021
Bitbucket pipeline for Android Firebase App Distribution
View bitbucket-pipelines.yml
image: bitbucketpipelines/android-ci-image
- step:
name: Setup & Deploy
image: java:8 #remove this line if plugin "com.starter.easylauncher" isn't used
- android-sdk
GuilhE / build.gradle.kts
Last active Sep 4, 2021
Gradle configurations to be used with bitbucket-pipelines.yml or
View build.gradle.kts
import java.util.*
buildTypes {
getByName("release") {
if (File("").exists()) {
signingConfig = SigningConfig("firebaseDistribution").apply {
val prop = Properties().apply { load(FileInputStream(File(""))) }
GuilhE /
Last active Apr 8, 2021
Firebase App Distribution (locally)
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
function getProperty() {
# shellcheck disable=SC2002
PROP_VALUE=$(cat $PROPERTY_FILE | grep -w "$PROP_KEY" | cut -d'=' -f2-)
echo "$PROP_VALUE"
GuilhE / deploy-bintray.gradle.kts
Created Feb 5, 2021
Gradle configurations to deploy both to Bintray and Maven
View deploy-bintray.gradle.kts
import com.jfrog.bintray.gradle.BintrayExtension
import com.jfrog.bintray.gradle.BintrayPlugin
import java.util.*
buildscript {
repositories {