val e = quote {
querySchema[TestEntity]("test_entity", _.s -> "field_s", _.i -> "field_i")
}
val e2 = quote {
querySchema[TestEntity]("test_entity_2", _.s -> "field_s_2", _.i -> "field_i_2")
}
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
implicit lazy val reads: Reads[CarMotor] = { | |
import play.api.libs.json._ | |
import play.api.libs.functional.syntax._ | |
(__ \ "engineType").read[String].flatMap { | |
case "electric" => | |
Reads.pure(Electric) | |
case "engine" => { | |
(__ \ "fuel").read[CarFuelType] and |
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 wolfendale.scalacheck.regexp.models | |
sealed trait Group[A] { | |
def intersect(other: Group[A]): Group[A] | |
def ++(other: Group[A]): Group[A] | |
def --(other: Group[A]): Group[A] | |
} |
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 scala.util.Random | |
implicit class SubsetList[A](list: List[A]) { | |
def sublists: Stream[List[A]] = for { | |
length <- (0 to list.length).toStream | |
combination <- list combinations length | |
} yield combination | |
} | |
def maxSublistBounded(list: List[Int], boundary: Int): (List[Int], Int) = { |
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
Play this game by pasting the script in http://www.puzzlescript.net/editor.html |
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 com.example | |
import javax.inject.Inject | |
import play.api.i18n.MessagesApi | |
import play.api.mvc._ | |
import scala.concurrent.Future | |
// note: `messagesApi` could be anything, it's just quite likely that your controller |
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 wolfendale | |
case class Person(name: String) | |
object Typeclasses extends App { | |
import Show.Showable | |
val tuple = (Person("Michael"), Person("Not Michael")) | |
val tuple2 = (Person("Michael"), (Person("Not Michael"), Person("Foo"))) |
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
sealed trait Foobar | |
case object Foo extends Foobar | |
case object Bar extends Foobar | |
case class Baz(foo: Boolean = false, bar: Boolean = false) | |
implicit val bazMon: Monoid[Baz] = | |
new Monoid[Baz] { | |
override def zero: Baz = Baz() | |
override def append(f1: Baz, f2: => Baz): Baz = |
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 wolfendale | |
trait Enum { | |
type Value <: Singleton | |
} | |
object Enum { | |
trait Aux[A <: Singleton] extends Enum { type Value = A } | |
} |
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 forms | |
import play.api.data.{FormError, Mapping} | |
import play.api.data.validation.Constraint | |
case class EitherMapping[L, R]( | |
lmapping: Mapping[L], | |
rmapping: Mapping[R], | |
key: String = "", | |
constraints: Seq[Constraint[Either[L, R]]] = Nil |
NewerOlder