Skip to content

Instantly share code, notes, and snippets.

Avatar
💾
undefined

Francis De Brabandere francisdb

💾
undefined
  • Ghent, Belgium
View GitHub Profile
@francisdb
francisdb / AkkaStreams.scala
Last active Oct 16, 2017
Akka streams utilities
View AkkaStreams.scala
import akka.NotUsed
import akka.stream.scaladsl.{Flow, Source} `
import akka.stream.{Attributes, FlowShape, Inlet, Outlet}
import akka.stream.Attributes._
import akka.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler}
import scala.collection.immutable.Seq
object AkkaStreams{
View keybase.md

Keybase proof

I hereby claim:

  • I am francisdb on github.
  • I am francisdb (https://keybase.io/francisdb) on keybase.
  • I have a public key ASDi22NaZc8VXnPYJss4TqmTHejsi7CTmjQBvRyqVulKqgo

To claim this, I am signing this object:

View gist:fde82f887df3d9f6fc23
while(true){
console.log("ok");
}
@francisdb
francisdb / android.headless.sh
Created Jan 8, 2014
Android headless sdk update
View android.headless.sh
./android list sdk --all
./android update sdk --no-ui --all --filter 87,81,1,2,3,82,tool,platform-tool
@francisdb
francisdb / gist:6630625
Created Sep 19, 2013
Debug maven test (waits for debugger to connect)
View gist:6630625
mvn clean test -Dmaven.surefire.debug -Dtest=com.bla.MyTest
View gist:6471158
implicit val pkWrites = new Writes[Pk[Long]] {
def writes(pk: Pk[Long]): JsValue = {
pk.toOption match {
case Some(value) => JsNumber(value)
case None => JsNull // TODO check if correct
}
}
}
@francisdb
francisdb / Dependencies.scala
Created Aug 29, 2013
JacksonMapper for easy json in scala
View Dependencies.scala
val fasterXmlJacksonVersion = "2.2.2"
val appDependencies = Seq(
"com.fasterxml.jackson.core" % "jackson-core" % fasterXmlJacksonVersion,
"com.fasterxml.jackson.core" % "jackson-annotations" % fasterXmlJacksonVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % fasterXmlJacksonVersion,
"com.fasterxml.jackson.module" %% "jackson-module-scala" % fasterXmlJacksonVersion
)
View play2_redeploy.sh
#!/bin/sh
export PATH=/opt/play2:$PATH
cd ~/server
rundir=myproject
repo=git@server:myproject.git
temp=$rundir.buid.temp
rm -rf $temp
@francisdb
francisdb / gist:5031171
Created Feb 25, 2013
add more automatic imports in play framework 2 templates
View gist:5031171
.settings{
routesImport += "se.radley.plugin.salat.Binders._",
templatesImport += "org.bson.types.ObjectId"
}
@francisdb
francisdb / gist:4514950
Last active Dec 11, 2015
Logging WS requests in playframework scala
View gist:4514950
// I'm looking for a better solution for the time logging (preferable in a transparent way)
private def logTime(message: String, promise: Future[Response]) = {
// not 100% ok, request is already running
// might even not be started yet
val now = System.currentTimeMillis
promise.onRedeem { response =>
val time = System.currentTimeMillis - now
logger.info(message + " => " + response.status + " " + time + "ms " + response.body.length + "b")
}