Skip to content

Instantly share code, notes, and snippets.

@casualjim
casualjim / hack.sh
Created March 31, 2012 23:15 — forked from nrk/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
implicit class PagePatternHelper(val sc: StringContext) extends AnyVal {
def page(args: Any*): PagePattern = {
val template = sc.standardInterpolator(treatEscapes, args)
val templateUrl = rl.Uri(template)
val path = templateUrl.path
val routeMatcher = new SinatraRouteMatcher(path)
val queryMultiParams = rl.MapQueryString.parseString(templateUrl.query.rawValue)
val queryParams = queryMultiParams.mapValues(_.head)
@casualjim
casualjim / scala-interview1.scala
Created May 1, 2013 19:55 — forked from oxbowlakes/scala-interview1.scala
simple exercise around map and flatmap
object GOption {
def some[A](a: A): GOption[A] = new GOption[A] {
def cata[B](n: => B, s: A => B): B = sys.error("Implement me")
}
def none[A]: GOption[A] = new GOption[A] {
def cata[B](n: => B, s: A => B): B = sys.error("Implement me")
}
}
trait GOption[+A] {
abstract class BaseResource(implicit protected val swagger: Swagger)
extends ScalatraServlet with FutureSupport with JacksonJsonSupport with SwaggerSupport with Imports {
override protected val applicationName = Some("messaging-api")
protected def applicationDescription = "Messaging Services API"
protected implicit val defaultTimeout = Timeout(5 seconds)
override val jsonpCallbackParameterNames: Iterable[String] = Some("callback")
@casualjim
casualjim / build-go-swagger.sh
Last active January 25, 2016 03:14 — forked from anonymous/build-go-swagger.sh
building go-swagger — for a five year old
#---- run this section just once ----#
export GOPATH="${HOME}/go"
export GO15VENDOREXPERIMENT='1'
`
cd $GOPATH/src/github.com/go-swagger/go-swagger
go get -u github.com/asaskevich/govalidator
go get -u github.com/naoina/denco
go get -u github.com/go-swagger/scan-repo-boundary/makeplans