Skip to content

Instantly share code, notes, and snippets.

post("/files") {
// HACK Transform all BigInts to Doubles
val transformedBody = parsedBody transformField {
case (key, JInt(bigInt)) => (key, JDouble(bigInt.toDouble))
}
val meta = transformedBody.asInstanceOf[JObject].values.get("meta").get.asInstanceOf[Map[String, Map[String, Any]]]
//...
/// Store in Database
updateFileMetadata(fileOrigin, meta)
@dozed
dozed / gist.scala
Last active December 19, 2015 03:38 — forked from denen99/gist:5891383
def createDataSource(name: String): ComboPooledDataSource = {
val cpds = new ComboPooledDataSource(name)
logger.info(f"Created c3p0 connection pool: $name")
cpds
}
val cpdsMaster = createDataSource("master")
val cpdsSlave = createDataSource("slave")
@dozed
dozed / Milestones.scala
Last active December 17, 2015 15:29 — forked from pollingj/Milestones
import org.scalatra.ScalatraServlet
import org.scalatra.json.JacksonJsonSupport
import java.util.Date
import com.novus.salat.annotations._
import com.novus.salat.dao.SalatDAO
import com.novus.salat.global._
import com.novus.salat.grater
import com.mongodb.casbah.Imports._