Skip to content

Instantly share code, notes, and snippets.

View casualjim's full-sized avatar

Ivan Porto Carrero casualjim

View GitHub Profile
upstream jetty {
server 127.0.0.1:12180;
}
server {
listen 80;
server_name www.api.backchat.io;
rewrite ^/(.*) http://api.backchat.io/$1 permanent;
}
@casualjim
casualjim / recipe.rb
Created October 5, 2011 09:37 — forked from rberger/recipe.rb
S3 File Resource for Chef
# Source accepts the protocol region:// with the host as the bucket
# access_key_id and secret_access_key are just that
# for the eu-west-1 region:
s3_file "/var/bulk/the_file.tar.gz" do
source "s3-eu-west-1://your.bucket/the_file.tar.gz"
access_key_id your_key
secret_access_key your_secret
owner "root"
group "root"
package backchat
package web
package auth
import model.User
import org.scalatra.auth.{ ScentryConfig, ScentrySupport }
import org.scalatra.ScalatraKernel
import org.scalatra.auth.strategy.BasicAuthSupport
/**
{
"id":"source:twitter/5f08d6b0-e2ce-11e0-bbc2-005056c00008",
"occurredAt":"2011-09-05T11:56:43.000Z",
"actor":{
"objectType":"person",
"id":"ro2cket",
"displayName":"Skunk Works",
"published":"2010-12-21T19:13:52.000Z",
"image":{
"url":"http://a0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png"
#!/bin/sh
curr=`dirname $0`/dist
cp=`echo $(pwd)/$curr/*.jar|sed 's/ /:/g'`
echo "the classpath:"
echo $cp
exec scala -classpath $cp $0 $@
!#
target
import javax.servlet.annotation._
import grizzled.generator._
import scala.annotation._
import scala.util.Random
trait Request
case object Request extends Request
trait Handler extends (Request => Response)
trait HandlerArgs {
def isInitial: Boolean
}
case object InitialArgs { val isInitial = true }
case object ContinuationArgs { val isInitial = false }
class Handler extends ((Request, HandlerArgs) => Response)
class Middleware extends (Handler => Handler)
<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" />
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
}
}