Skip to content

Instantly share code, notes, and snippets.

View sullivan-'s full-sized avatar

John Sullivan sullivan-

View GitHub Profile
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
### Keybase proof
I hereby claim:
* I am sullivan- on github.
* I am johnsullivanmscs (https://keybase.io/johnsullivanmscs) on keybase.
* I have a public key whose fingerprint is 4B13 C0DD DF42 8389 BDAD 11D9 A36D 692F 7D01 8E5D
To claim this, I am signing this object:
@sullivan-
sullivan- / run.scala
Last active March 13, 2017 16:11
demonstrates odd Iteratee.foreach behavior
object Run extends App {
import cats._
import io.iteratee._
import io.iteratee.internal._
def e = Enumerator.enumVector[Eval, Int]((0 until 10).toVector)
def ge = e.grouped(3)
println("fold ge")
Iteratee.foreach[Eval,Vector[Int]](println).apply(ge).run.value
@sullivan-
sullivan- / crash.scala
Last active May 20, 2016 17:12
crashing the scala compiler
object crash {
class Bar[A]
def bar[A](barOpt: Option[Bar[_ >: A]]): Bar[A] = new Bar
def build[A](barOpt: Option[Bar[_ >: A]]): Bar[A] =
// fix the crash by inserting "[A]" on the following line
bar(barOpt)
package longevity.persistence
import longevity.subdomain.PRef
import longevity.subdomain.Root
import longevity.subdomain.root.Query
import scala.concurrent.Future
/** a repository for aggregate roots of type `R` */
trait Repo[R <: Root] {
import longevity.subdomain.Assoc
import longevity.subdomain.RootType
import longevity.subdomain.root.Key
import longevity.subdomain.root.KeyVal
object User extends RootType[User] {
object props {
val username = prop[String]("username")
}
val usernameKey = key(props.username)
import longevity.subdomain._
case class User(
username: String,
firstName: String,
lastName: String)
extends Root
object User extends RootType[User] {
object props {
object User extends RootType[User] {
object props {
val username = prop[String]("username")
val firstName = prop[String]("firstName")
val lastName = prop[String]("lastName")
}
val usernameKey = key(props.username)
val fullnameKey = key(props.firstName, props.lastName)
}
import longevity.subdomain._
case class User(
username: String,
firstName: String,
lastName: String)
extends Root
object User extends RootType[User] {
object props {
package longevity.integration.quickStart
import com.github.nscala_time.time.Imports._
import org.scalatest.OptionValues._
import org.scalatest._
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.concurrent.ScaledTimeSpans
import org.scalatest.time._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future