Skip to content

Instantly share code, notes, and snippets.

View fancywriter's full-sized avatar

Pavel Kozlov fancywriter

  • Dublin, Ireland
View GitHub Profile
@jrudolph
jrudolph / JsonRejectionHandler.scala
Created March 6, 2014 11:29
Custom rejection handler that returns JSON
case class ErrorMessage(message: String, cause: String)
object ErrorMessage {
import spray.json.DefaultJsonProtocol._
implicit val errorFormat = jsonFormat2(ErrorMessage.apply)
}
import spray.httpx.SprayJsonSupport._
implicit val jsonRejectionHandler = RejectionHandler {
case MalformedRequestContentRejection(msg, cause) :: Nil =>
complete(StatusCodes.BadRequest, ErrorMessage("The request content was malformed", msg))
@bhcopeland
bhcopeland / 10-monitor.conf
Created January 21, 2014 13:21
Macbook pro Retina 11,1 xorg.conf run at 1920x1200 resolution. /etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
Identifier "Monitor0"
Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
EndSection
Section "Screen"
Identifier "Screen0"
Device "eDP1"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
@ramn
ramn / shutdownHook.scala
Created August 21, 2011 23:14
Register ShutdownHook (Scala)
object ShutDown {
def main(args: Array[String]) {
sys.ShutdownHookThread {
println("exiting")
}
println("begin sleep")
Thread.sleep(5000L)
println("done sleeping")