This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.typesafe.config.Config | |
import longevity.context.LongevityContext | |
import longevity.subdomain._ | |
val bloggingDomain: CoreDomain = | |
CoreDomain("blogging", EntityTypePool.empty) | |
val bloggingConfig: Config = loadBloggingConfig() | |
val bloggingContext = LongevityContext( | |
bloggingDomain, | |
Mongo, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait UserService { | |
def updateScoreCard(user: User, event: PointScoredEvent): User | |
} | |
val userService: UserService = getUserService() | |
val userState: PState[User] = getUserState() | |
val updatedState: PState[User] = userState.map { user => | |
userService.updateScoreCard(user, event) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait PState[R <: Root] { | |
def get: R | |
def map(f: R => R): PState[R] | |
} | |
val userState: PState[User] = getUserState() | |
val user: User = userState.get | |
val updatedState: PState[User] = userState.map(_.copy(title = Some(newTitle))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class User( | |
id: Long, | |
username: String, | |
fullname: String, | |
email: Email, | |
profile: Option[UserProfile], | |
version: Int, | |
createdBy: String, | |
createdDate: DateTime, | |
modifiedBy: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.github.nscala_time.time.Imports._ | |
import longevity.persistence.PState | |
import scala.concurrent.Future | |
val blogState: PState[Blog] = getBlogState() | |
val recentPosts: Future[Seq[PState[BlogPost]]] = blogPostRepo.retrieveByQuery { | |
import BlogPost.queryDsl._ | |
import BlogPost.props._ | |
blog eqs blogState.assoc and postDate gt DateTime.now - 1.week |
NewerOlder