Skip to content

Instantly share code, notes, and snippets.

View hoangchungk53qx1's full-sized avatar
๐Ÿ˜†
Out sick

hoangchung hoangchungk53qx1

๐Ÿ˜†
Out sick
View GitHub Profile
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
extension Publisher {
// The flatMapLatest operator behaves much like the standard FlatMap operator, except that whenever
// a new item is emitted by the source Publisher, it will unsubscribe to and stop mirroring the Publisher
// that was generated from the previously-emitted item, and begin only mirroring the current one.
func flatMapLatest<T: Publisher>(_ transform: @escaping (Self.Output) -> T) -> Publishers.SwitchToLatest<T, Publishers.Map<Self, T>> where T.Failure == Self.Failure {
map(transform).switchToLatest()
}
}
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.Scheduler
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.kotlin.subscribeBy
import io.reactivex.rxjava3.schedulers.Schedulers
import java.util.*
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
import kotlin.math.pow
import kotlin.random.Random