Skip to content

Instantly share code, notes, and snippets.

View parth-patil's full-sized avatar

Parth Patil parth-patil

View GitHub Profile
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
import com.twitter.util.{Future => TwFuture}
import scala.concurrent.{Future => ScFuture, promise => ScPromise}
implicit def twFutureToScala[T](twFuture: TwFuture[T]): ScFuture[T] = {
val prom = ScPromise[T]
twFuture.onSuccess { res: T =>
prom.success(res)
}
twFuture.onFailure { t: Throwable =>
prom.failure(t)
}