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 InjuryTester { | |
implicit val dateRW = new BSONReader[BSONDateTime,Date] with BSONWriter[Date,BSONDateTime] { | |
def read(bson: BSONDateTime): Date = new Date(bson.value) | |
def write(date: Date): BSONDateTime = BSONDateTime(date.getTime) | |
} | |
implicit val pijHandler = Macros.handler[PlayerInjury] | |
implicit val ijHandler = Macros.handler[Injury2] |
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
[ | |
{ | |
"game_id": 3862, | |
"gametime": "2013-12-02T13:00:00.000Z", | |
"datetime": "2013-12-02T13:25:21.000Z", | |
"seq_id": 10, | |
"details": { | |
"location": "Soldier Field", | |
"status": "IP", | |
"quarter": "1", |
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
error { | |
case e => { | |
val logger = LoggerFactory.getLogger(getClass) | |
logger.info("an exception occurred: " + e.printStackTrace()) | |
//logger.info("the request body is: " + request) | |
NotFound("An error occurred, please contact [email protected]") | |
} | |
} |
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
{13-10-09 15:14}[2.0.0-p247]normandy:~/Projects/streaming sf% ruby atmosphere_test.rb | |
<!-- ---------------------------------------------------------------- http://github.com/Atmosphere ------------------------------------------------------------------------ --> | |
<!-- Welcome to the Atmosphere Framework. To work with all the browsers when suspending connection, Atmosphere must output some data to makes WebKit based browser working.--> | |
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> | |
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> | |
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> | |
<!-- --------------------------------------------------------- |
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
import sbt._ | |
import Keys._ | |
import org.scalatra.sbt._ | |
import org.scalatra.sbt.PluginKeys._ | |
import com.mojolly.scalate.ScalatePlugin._ | |
import ScalateKeys._ | |
object AtmosphereBuild extends Build { | |
val Organization = "com.example" | |
val Name = "Scalatra Atmosphere Example" |
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
html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> | |
<title>Error 500 No AtmosphereHandler found.</title> | |
</head> | |
<body><h2>HTTP ERROR 500</h2> | |
<p>Problem accessing /the-chat. Reason: | |
<pre> No AtmosphereHandler found.</pre></p><h3>Caused by:</h3><pre>org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler found. | |
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:190) | |
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:167) |
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
name := "tsn-api-live" | |
version := "1.0-SNAPSHOT" | |
libraryDependencies ++= Seq( | |
jdbc, | |
anorm, | |
cache, | |
"net.debasishg" % "redisclient_2.10" % "2.11" | |
) |
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 com.sportsnetwork.stream.models | |
import akka.actor.{ ActorSystem, Props } | |
import play.api.libs.iteratee._ | |
import play.api.libs.json._ | |
import play.api.Logger | |
import com.redis._ |
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 ScoresStream extends Actor with akka.actor.ActorLogging { | |
//log.info("We've got yet another pigdog on our hands") | |
var members = Set.empty[String] | |
val (scoresEnumerator, scoresChannel) = Concurrent.broadcast[JsValue] | |
case class Message(kind: String, user: String, message: String) | |
implicit val messageReads = Json.reads[Message] | |
implicit val messageWrites = Json.writes[Message] |
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
{ | |
"gamedate": "12/02/2013", | |
"updated_at": "2013-12-02 17:35:22 UTC", | |
"games": [ | |
{ | |
"game": { | |
"home_team_name": "Washington", | |
"game_id": 18413, | |
"visiting_team_name": "Orlando", | |
"home_team_id": 113, |