Skip to content

Instantly share code, notes, and snippets.

View lJoublanc's full-sized avatar

Luciano lJoublanc

  • Digital Asset
  • Zürich
View GitHub Profile
@lJoublanc
lJoublanc / race.scala
Created August 9, 2017 15:29
Example of race condition fs2 branch 0.10.0: Signal completes before we can get any values out.
import fs2._
import cats.effect._
import fs2.async.mutable.Signal
import scala.concurrent.ExecutionContext.Implicits.global
implicit val ioInstance = Effect[IO]
val input = Stream.range(1,20).covary[IO] // <-- try changing this to range(1,2), result is empty!
val output : Stream[IO,Signal[IO,Option[Int]]] =
Stream eval async.signalOf[IO,Option[Int]](Some(0)) flatMap { sig =>
@lJoublanc
lJoublanc / Example.scala
Created January 11, 2017 08:54
Example of how to use Slick's MappedJdbcType in practice
// This does the conversion from enum to char and vice-versa.
abstract class JDBCCharEnumeration extends Enumeration {
import slick.jdbc.HsqldbProfile.api._ //from what I recall changing this to JDBCProfile does *not* work. Must use specific driver.
import slick.jdbc.HsqldbProfile.MappedJdbcType
implicit def enumMapper = MappedJdbcType.base[Value,Char](_.id.toChar, this(_))
}
// The enumeration
object OrderExpiry extends JDBCCharEnumeration {
@lJoublanc
lJoublanc / testpickle.ipynb
Created December 29, 2014 14:50
Serializing pandas df to mongodb using existing msgpack packers
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.