Skip to content

Instantly share code, notes, and snippets.

View streetsofboston's full-sized avatar

Anton Spaans streetsofboston

  • Intrepid Pursuits, LLC
  • Cambridge, MA
View GitHub Profile
@streetsofboston
streetsofboston / ReplayingUnfinalizedShare.kt
Created July 16, 2018 14:02
This is like the `ReplayingShare`, but it will cause a re-subscribe when the upstream finalizes. This can be handy for emitted resources that get stale.
package io.intrepid.bleidiom.util
import io.reactivex.Flowable
import io.reactivex.FlowableTransformer
import io.reactivex.Observable
import io.reactivex.ObservableTransformer
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
import io.reactivex.functions.Action
import io.reactivex.functions.Consumer
@streetsofboston
streetsofboston / RxIfThenElseTransformer.kt
Last active April 27, 2021 09:44
Rx Java and If-Then-Else like behavior:
/*
* Copyright (c) 2018 Intrepid Pursuits, Inc. All rights reserved.
*/
package io.intrepid.bleidiom.util
import io.reactivex.Observable
import io.reactivex.ObservableSource
import io.reactivex.ObservableTransformer
import io.reactivex.functions.Function
@streetsofboston
streetsofboston / TestCoroutineContext.kt
Last active May 28, 2018 11:42
Kotlin Unit Tests Util for having testable functions using Coroutines: TestCoroutineContext
@file:Suppress("PackageDirectoryMismatch")
/*
* Copyright (c) 2018 Intrepid Pursuits,Inc. All rights reserved.
*/
package kotlinx.coroutines.experimental.intrepid
import kotlinx.coroutines.experimental.*
import java.util.concurrent.PriorityBlockingQueue
import java.util.concurrent.TimeUnit