First introduced at Starmount Chili Cook-Off 2015. Won third place prize, defeating animal-based chili!
- 2015: 3rd place
- 2016: 9th place
- 30 fl. oz Organic Tomato Sauce
| /** Generator that distributes the available size to two component generators, | |
| * and then combines the results. Can be used to generate nested structures | |
| * where the total number of component/leaf elements is effectively controlled | |
| * by the size parameter. | |
| */ | |
| def deepSized[A, B, C](ga: Gen[A], gb: Gen[B])(f: (A, B) => C): Gen[C] = | |
| for { | |
| n <- Gen.size | |
| x <- Gen.choose(0, n) | |
| a <- Gen.resize(x, ga) |
| package taggettest | |
| import org.scalatest.FlatSpec | |
| import org.scalatest.Matchers | |
| import play.api.libs.json._ | |
| import scalaz.{Tag, @@} | |
| sealed trait UserTag |
| package future_test | |
| import scala.concurrent.{ExecutionContext, Future} | |
| object ExampleCode { | |
| def execute()(implicit ec: ExecutionContext): Future[String] = { | |
| Future { throw new TestException("Some data") } | |
| } | |
| } |
| // | |
| // Disjunction - aka Scalaz Either | |
| // \/[A, B] is an alternative to Either[A, B] | |
| // -\/ is Left (usually represents failure by convention) | |
| // \/- is Right (usually represents success by convention) | |
| // Left or Right - which side of the Disjunction does the "-" appear? | |
| // | |
| // Prefer infix notation to express Disjunction Type v: String \/ Double | |
| // | |
| // References |
| package akkahttptest | |
| import akka.actor.ActorSystem | |
| import akka.http.Http | |
| import akka.stream.FlowMaterializer | |
| import akka.http.server._ | |
| import akka.http.marshalling.PredefinedToResponseMarshallers._ | |
| import akka.stream.scaladsl.{HeadSink, Source} | |
| object Proxy extends App { |
| /** | |
| The Play (2.3) json combinator library is arguably the best in the scala world. However it doesnt | |
| work with case classes with greater than 22 fields. | |
| The following gist leverages the shapeless 'Automatic Typeclass Derivation' facility to work around this | |
| limitation. Simply stick it in a common location in your code base, and use like so: | |
| Note: ** Requires Play 2.3 and shapeless 2.0.0 | |
| // Coproduct is extension of Either concept, to N multually exlusive choices | |
| type ISB = Int :+: String :+: Boolean :+: CNil | |
| val isb = Coproduct[ISB]("foo") //> isb : qaaz.ISB = foo | |
| isb.select[Int] //> res0: Option[Int] = None | |
| isb.select[String] //> res1: Option[String] = Some(foo) |
| import org.scalatest._ | |
| import prop._ | |
| import org.scalacheck.Arbitrary._ | |
| import org.scalacheck.Gen | |
| /** | |
| * Solutions to the ScalaCheck problem that shrinking failing values may generate | |
| * invalid values, because the constraints of the generator are not respected. | |
| * | |
| * See also http://stackoverflow.com/questions/20037900/scalacheck-wont-properly-report-the-failing-case |
| Rotate videos 90 or 180 degrees using ffmpeg. |