Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

glureau-betclic

🎯
Focusing
View GitHub Profile
@glureau-betclic
glureau-betclic / Kotlin_RxJava_Single.kt
Last active May 6, 2020
TechYourChance / Concurrency Frameworks in Android are overrated / Kotlin+RxJava
View Kotlin_RxJava_Single.kt
// Original code: https://www.techyourchance.com/concurrency-frameworks-overrated-android/
import io.reactivex.Single
import io.reactivex.disposables.Disposable
import io.reactivex.functions.BiFunction
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.io.File
import java.io.IOException
import java.util.concurrent.CountDownLatch
@glureau-betclic
glureau-betclic / Kotlin_RxJava.kt
Created May 6, 2020
TechYourChance / Concurrency Frameworks in Android are overrated / Kotlin+RxJava
View Kotlin_RxJava.kt
// Original code: https://www.techyourchance.com/concurrency-frameworks-overrated-android/
import io.reactivex.Observable
import io.reactivex.disposables.Disposable
import io.reactivex.functions.BiFunction
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.io.File
import java.io.IOException
import java.util.concurrent.CountDownLatch
View gist:7f9cca939adee6afe89efc5f7fac230c
fun main() {
val transformation = Transformation.TransformationComposite(listOf(Transformation.NoOpTransformation()))
println("Res: ${transformation(Shape())}")
}
class Shape
sealed class Transformation {
class NoOpTransformation : Transformation()
class TransformationComposite(val transformations: List<Transformation>) : Transformation()
View JUnit4-CompositeRules.kt
package com.betclic.test
import org.junit.After
import org.junit.Before
interface Rule {
fun onBefore() {}
fun onAfter() {}
}
View RX thread switching benchmark
class MainActivity : AppCompatActivity() {
private var switchFromIoToCompute = 0L
private var switchFromComputeToIo = 0L
private var loopCount = 0L
private var appCreated = 0L
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
You can’t perform that action at this time.