06:52 jakedouglas: [23:22:23] hmm. the example atmosphere code doesn't really click with me
06:52 casualjim: [23:22:34] yes because it's input and output
06:52 casualjim: [23:23:31] i'll map lines
06:52 casualjim: [23:23:33] https://github.com/scalatra/scalatra/blob/develop/example/src/main/scala/org/scalatra/ChatServlet.scala#L13
06:52 casualjim: [23:23:46] https://github.com/scalatra/scalatra/blob/develop/example/src/main/scala/org/scalatra/MeteorChatExample.scala#L53
06:52 casualjim: [23:23:53] that's the same point in the lifecycle
06:52 casualjim: [23:24:11] https://github.com/scalatra/scalatra/blob/develop/example/src/main/scala/org/scalatra/ChatServlet.scala#L22-36
06:52 casualjim: [23:24:27] https://github.com/scalatra/scalatra/blob/develop/example/src/main/scala/org/scalatra/MeteorChatExample.scala#L59-78
06:52 casualjim: [23:24:46] the "success" is just to force flushing the buffer it never arrives in the browser
06:52 casualjim: [23:25:14] https://github.com/scalatra/scalatra/blob
This file contains hidden or 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 mojolly.testing | |
| import org.specs2.specification._ | |
| import akka.actor._ | |
| import akka.testkit.TestKit | |
| trait AkkaContext extends After { | |
| val testkit = new TestKit(ActorSystem(newUuid().toString)) | |
| implicit def system = testkit.system |
This file contains hidden or 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
| scala> def test(a: Any) = a match { | |
| | case _ : Unit => "Unit" | |
| | case _ => "Other" | |
| | } | |
| test: (a: Any)java.lang.String | |
| scala> test(()) | |
| res1: java.lang.String = Unit | |
| scala> test(println("hello")) |
This file contains hidden or 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 bumpPatch = TaskKey[String]("bump-patch") | |
| settings ++ Seq( | |
| bumpPatch <<= (version) map { ver => | |
| val Array(patch:Int, minor:Int, major:Int) = "0.0.1".split("\\.").reverse.map(_.toInt) | |
| val newVer = "%d.%d.%d".format(major, minor, patch+1) | |
| version := newVer | |
| newVer | |
| } | |
| ) |
This file contains hidden or 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 HttpMethod | |
| object HttpPostMethod extends HttpMethod { override def toString = "POST" } | |
| object HttpGetMethod extends HttpMethod { override def toString = "GET" } | |
| object HttpDeleteMethod extends HttpMethod { override def toString = "DELETE" } | |
| object HttpPutMethod extends HttpMethod { override def toString = "PUT" } | |
| trait Param { | |
| def name: String | |
| def description: String |
This file contains hidden or 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 ActorSpecification extends BaseSpecification | |
| with ArgumentsArgs | |
| with ArgumentsShortcuts | |
| with MustThrownMatchers | |
| with ShouldThrownMatchers | |
| with FormattingFragments | |
| with StandardResults | |
| with StandardMatchResults | |
| with PendingUntilFixed | |
| with TimeHelpers |
This file contains hidden or 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 Paginator[A]( | |
| val adapter: Adapter[A], | |
| val currentPage: Int = 1, | |
| val maxPerPage: Int = 10 | |
| ) extends PaginatorLike[A] { | |
| assert(maxPerPage > 0, "Max per page must be greater than zero") | |
| assert(currentPage > 0, "Current page must be greater than zero") |
This file contains hidden or 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
| # /etc/haproxy/haproxy.cfg, version 1.5 | |
| global | |
| maxconn 4096 | |
| #user haproxy | |
| #group haproxy | |
| #daemon | |
| defaults | |
This file contains hidden or 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 Main { | |
| def main(args: Array[String]) { | |
| MySquerylScheme.initialize() | |
| WebServer("src/main/webapp", Config.webServerPort) { server => | |
| server.inContext("/api") { context => | |
| context.mount("validate", new ValidateApp) | |
| context.mount("channels", new MessageChannelApp) | |
| context.mount("streams", new StreamsApp) |
This file contains hidden or 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 backchat | |
| package web | |
| import javax.servlet.http.{ HttpServletResponse, HttpServletRequest } | |
| import org.scalatra._ | |
| import collection.JavaConversions._ | |
| object CORSSupport { | |
| val ORIGIN_HEADER: String = "Origin" | |
| val ACCESS_CONTROL_REQUEST_METHOD_HEADER: String = "Access-Control-Request-Method" |