Skip to content

Instantly share code, notes, and snippets.

get("/:slug(.:format)(/)") {
if (params.get('slug).map(_.toLowerCase(ENGLISH)) == Some("index.json")) pass()
}
get("/(index(.:format))") {
}
# Upstart file for sinatra github hook
start on runlevel [2345]
stop on runlevel [06]
#console logged
#respawn
env RUBYOPT=rubygems
sudo initctl emit -n my-event
object BackchatString {
/**
* Remove non-latin signs from text regular expression
*/
val NON_LATIN = """[^A-Za-z0-9\-\.]""".r
/**
* Remove whitespace regular expression
*/
val WHITESPACE = """[\s]""".r
[warn] :: org.scalatra#scalatra-auth_2.9.0-1;2.0.0-SNAPSHOT: java.text.ParseException: [unknown tag project in file:/Users/ivan/.ivy2/cache/org.scalatra/scalatra-auth_2.9.0-1/ivy-2.0.0-SNAPSHOT.xml.original
[warn] , unknown tag modelVersion in file:/Users/ivan/.ivy2/cache/org.scalatra/scalatra-auth_2.9.0-1/ivy-2.0.0-SNAPSHOT.xml.original
[warn] , unknown tag groupId in file:/Users/ivan/.ivy2/cache/org.scalatra/scalatra-auth_2.9.0-1/ivy-2.0.0-SNAPSHOT.xml.original
[warn] , unknown tag artifactId in file:/Users/ivan/.ivy2/cache/org.scalatra/scalatra-auth_2.9.0-1/ivy-2.0.0-SNAPSHOT.xml.original
[warn] , unknown tag packaging in file:/Users/ivan/.ivy2/cache/org.scalatra/scalatra-auth_2.9.0-1/ivy-2.0.0-SNAPSHOT.xml.original
[warn] , unknown tag version in file:/Users/ivan/.ivy2/cache/org.scalatra/scalatra-auth_2.9.0-1/ivy-2.0.0-SNAPSHOT.xml.original
[warn] , unknown tag name in file:/Users/ivan/.ivy2/cache/org.scalatra/scalatra-auth_2.9.0-1/ivy-2.0.0-SNAPSHOT.xml.original
[warn] , unknown tag description in file:
object MultiMap {
type Coll = MultiMap
def apply(elems: (String, Seq[String])*): MultiMap = (newBuilder ++= elems).result
def newBuilder: Builder[(String, Seq[String]), MultiMap] = new MapBuilder[String, Seq[String], MultiMap](empty)
implicit def canBuildFrom: CanBuildFrom[Map[String, Seq[String]], (String, Seq[String]), MultiMap] = {
new CanBuildFrom[Map[String, Seq[String]], (String, Seq[String]), MultiMap] {
@casualjim
casualjim / lift_mongo_specification.scala
Created August 25, 2011 19:49
A versioning trait for lift-mongodb-record models with rogue
package mojolly
package mongo
package tests
import org.specs2.Specification
import org.specs2.specification.{ Step, Fragments }
import net.liftweb.mongodb._
import mongo.MongoConfig.MongoConfiguration
trait LiftMongoDbSpecification extends Specification {
@casualjim
casualjim / xsbt.sh
Created August 29, 2011 15:30
Working sbt build script for Jenkins to allow more than 1 project to build at a time
#!/bin/sh
mkdir -p $WORKSPACE/project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/extra
mkdir -p $WORKSPACE/../sbt/plugins/project
cp $HOME/share/java/*.jar $WORKSPACE/project/boot/scala-2.8.1/org.scala-tools.sbt/sbt/0.10.1/extra
cp $HOME/.sbt/plugins/Jenkins.scala $WORKSPACE/../sbt/plugins
cp $HOME/.sbt/plugins/project/build.scala $WORKSPACE/../sbt/plugins/project
java -Xms512m -Xmx2048m -XX:ReservedCodeCacheSize=256m -XX:MaxPermSize=512m -Xss8m -XX:+CMSClassUnloadingEnabled -Dsbt.global.base=$WORKSPACE/../sbt -Dfile.encoding='UTF-8' -Dsbt.ivy.home=$WORKSPACE/project/ivy2 -Dsbt.log.noformat=true -jar `dirname $0`/sbt-launch.jar "$@"
object PfExample {
val Path = """/users/(.*)""".re // pretty non-sensical in real life
def handleRequest: PartialFunction[Response] = {
case Path(theUserId) => {
// do heaps of stuff
// create response
}
}
<dependencies>
<exclude module="lift-common_2.9.0-1" />
<exclude module="lift-actor_2.9.0-1" />
<exclude module="lift-framework_2.9.0-1" />
<exclude module="lift-record_2.9.0-1" />
<exclude module="lift-util_2.9.0-1" />
<exclude module="lift-webkit_2.9.0-1" />
<exclude module="lift-json_2.9.0-1" />
<exclude module="lift-json-ext_2.9.0-1" />
<exclude module="lift-mongodb-record_2.9.0-1" />