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 play.api.libs.concurrent.Akka | |
import akka.actor.{ Props, Actor } | |
import concurrent.ExecutionContext | |
import scala.concurrent.duration._ | |
import ExecutionContext.Implicits.global | |
import play.api.test._ | |
object AkkaScheduler extends WithApplication with App { | |
case object Tick |
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
def print(json: JsValue): String = { | |
json match { | |
case JsObject(values) => | |
val contents = | |
values.map { | |
case (k, v) => s""""$k" -> ${print(v)}""" | |
}.mkString(", ") | |
s"Json.obj($contents)" | |
case JsArray(values) => |
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
//The following example allows you to post `multipart/form-data`. It is a simple version that only | |
//works with `String` values, but it could easily be modified to use other types of data. | |
type NameValuePair = (String, String) | |
case class MultipartFormData(elements: Seq[NameValuePair], boundary: String)( | |
implicit codec: Codec) { | |
private val HTTP_SEPARATOR = "\r\n" | |
private val actualBoundary = "--" + boundary | |
private val endBoundary = actualBoundary + "--" + HTTP_SEPARATOR |
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 org.qirx.browserTests | |
import scala.concurrent.Future | |
import scala.concurrent.Promise | |
import scala.concurrent.duration._ | |
import scala.util.Try | |
import akka.actor.Actor | |
import akka.actor.ActorRef | |
import akka.actor.ActorSystem |
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 shapeless._ | |
import shapeless.ops.hlist._ | |
import scala.util.Try | |
object validation { | |
trait Violation { | |
def message: String | |
} | |
abstract class SimpleViolation(val message: String) extends Violation |
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 Interact[A] | |
case class Ask(prompt: String) | |
extends Interact[String] | |
case class Tell(msg: String) | |
extends Interact[Unit] | |
trait Monad[M[_]] { | |
def pure[A](a: A): M[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 test2 | |
import scala.language.higherKinds | |
trait T1[A] | |
trait T2[A] | |
trait T3[A] | |
trait TypeList | |
trait Nil extends TypeList |
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 test | |
import scala.language.higherKinds | |
case class Program[F[_], A](free: Free[F, A]) { | |
import Coproduct.| | |
def flatMap[G[_], B](f: A => Program[G, B])( | |
implicit c: F | G): Program[c.Out, B] = |
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 javax.servlet.http.HttpServletRequest | |
class FakeHttpServletRequest extends HttpServletRequest { | |
// Members declared in javax.servlet.http.HttpServletRequest | |
def authenticate(x$1: javax.servlet.http.HttpServletResponse): Boolean = ??? | |
def getAuthType(): String = ??? | |
def getContextPath(): String = "/" | |
def getCookies(): Array[javax.servlet.http.Cookie] = Array.empty | |
def getDateHeader(x$1: String): Long = ??? | |
def getHeader(x$1: String): 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
package experiment | |
import scala.concurrent.ExecutionContext | |
import scala.concurrent.Future | |
import scala.language.higherKinds | |
import scala.language.implicitConversions | |
import scala.reflect.ClassTag | |
import akka.actor.Actor | |
import akka.actor.ActorRef |
OlderNewer