iTerm2 has a neat feature called a trigger, which you can use to notify you about finished maven builds (failure or success) or anything else happening in your console.
brew install terminal-notifier
def get(String path, Closure ... closures) { | |
spark.Spark.get(createClosureBasedRouteForPath(path, closures)) | |
} | |
private Route createClosureBasedRouteForPath(String path, Closure ... closures) { | |
new Route(path) { | |
def handle(Request request, Response response) { | |
closures*.delegate = this | |
return closures*.call(request, response).findAll { it }.join() | |
} |
def authCheck = { Request request, Response response -> | |
if (request.session().attribute('userLogin') != request.params(':name')) { | |
halt(401, "No permissions to check for ${request.params(":name")}\n") | |
} | |
} | |
get "/greet/:name", authCheck, { Request request, Response response -> | |
return "Hello " + request.params('name') + "\n" | |
} |
def jsonClosure = { Request request, Response response -> | |
if (request.contentType() == 'application/json') | |
json([name: request.attribute('name')]) | |
} | |
def xmlClosure = { Request request, Response response -> | |
if (request.contentType() == 'application/xml') | |
'<name>' + request.attribute('name') + '</name>\n' | |
} | |
# curl -v -X POST localhost:4567/login/foo | |
> POST /login/foo HTTP/1.1 | |
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3 | |
> Host: localhost:4567 | |
> Accept: */* | |
> | |
< HTTP/1.1 204 No Content | |
< Set-Cookie: JSESSIONID=1pouphqxh5z3l1pusx23ewksw6;Path=/ | |
< Expires: Thu, 01-Jan-1970 00:00:00 GMT |
-Drebel.plugins=/path/to/jrebel-spark-plugin/target/jrebel-plugin-spark-0.1-SNAPSHOT.jar | |
-Drebel.jr-spark-groovy=true | |
-Drebel.spark.app.class=de.spinscale.spark.WebServer | |
-Drebel.spark.app.method=init |
#!/bin/bash | |
set -e | |
if [ "x$1" == "x-h" ] ; then | |
echo "Usage: $0 version destdir plugins" | |
exit | |
fi | |
CURRENT="0.90.0.RC1" |
curl -X PUT localhost:9200/geotest/ | |
curl -X PUT localhost:9200/geotest/geotest/_mapping -d '{ | |
"geotest": { | |
"properties": { | |
"location": { | |
"type": "geo_point", | |
"lat_lon": true, | |
"geohash": true | |
} |
# GET ES | |
# https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.2.1.zip | |
# Unzip it | |
# unzip elasticsearch-1.2.1.zip | |
# cd elasticsearch-1.2.1 | |
# Look around | |
# Show structure |
// poor mans flash scope | |
// message appears once, but reloading in the browser makes it vanish | |
app.use(function(req, res, next){ | |
if (req.session.message !== null) { | |
res.locals.message = req.session.message | |
req.session.message = null | |
} | |
next(); | |
}); |