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
val extractedInfo = extractUnmatchedPath & extractRequest & extractClientIP & extractHost | |
val route = extractedInfo { (path, req, addr, host) => | |
// Use the path, addr and host to figure out where the request goes | |
// and how to rewrite the request | |
Http().singleRequest(req) | |
} |
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
" format / wrap and gq comments but not code | |
setlocal formatoptions=crq | |
" wrap comments at 80 chars | |
setlocal textwidth=80 | |
"highlight the 100'th column | |
set colorcolumn=100 |
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
class MyActorSpect // with mixins | |
{ | |
class SubActorSys(name) extends ActorSys(name) { | |
def makeActor(): ActorRef = system.actorOf(Props(new MyActor), "MyActor") | |
} | |
"My Actor" should { | |
"do something" in new SubActorSys("Test1") { | |
// blah | |
} |
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 set(key: String, value: String)(implicit ec: ExecutionContext, jitter: TTLJitter = NoJitter): Future[CAS] | |
def set(key: String, value: ByteString)(implicit ec: ExecutionContext, jitter: TTLJitter = NoJitter): Future[CAS] | |
// Compiler error: ... multiple overloaded alternatives of method set define default arguments. |
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
[error] found : B1(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse) | |
[error] required: B1(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse)(in method applyOrElse) |
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 around[A](before: RequestContext => (RequestContext, A))(after: A => HttpResponse => HttpResponse): Directive0 = | |
mapRequestContext { ctx => | |
val (newCtx, a) = before(ctx) | |
newCtx.withHttpResponseMapped(after(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 spray.json._ | |
object MyProtocol extends DefaultJsonProtocol { | |
implicit object MyMessageFormat extends RootJsonFormat[MyMessage] { | |
def write(msg: MyMessage) = JsObject("arg1" -> JsString(msg.arg1), "arg2" -> JsString(msg.arg2)) | |
def read(value: JsValue) = value.asJsObject.getFields("arg1", "arg2") match { | |
case Seq(JsString(arg1), JsString(arg2)) => new MyMessage(arg1, arg2) | |
case _ => deserializationError("MyMessage expected") | |
} | |
} |
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.derekwyatt | |
import spray.http._ | |
import spray.http.MediaTypes._ | |
import spray.httpx.encoding._ | |
import spray.httpx.SprayJsonSupport | |
import spray.json._ | |
import spray.json.DefaultJsonProtocol | |
import spray.routing.HttpService |
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
#!/usr/bin/env ruby | |
# Load in the PrimalAccess class | |
require './PrimalAccess.rb' | |
require 'rubygems' | |
# We require this particular gem | |
# | |
# To install it: | |
# gem install json |
NewerOlder