Skip to content

Instantly share code, notes, and snippets.

View pledbrook's full-sized avatar

Peter Ledbrook pledbrook

View GitHub Profile
@pledbrook
pledbrook / CommonTagLib.groovy
Created May 16, 2012 07:51
Example map with enum keys
import org.grails.common.ApprovalStatus
import static org.grails.common.ApprovalStatus.*
class CommonTagLib {
static namespace = "common"
static final STATUS_TO_CSS_CLASS = [
(PENDING): "warning",
(REJECTED): "important",
(APPROVED): "success" ].asImmutable()
@pledbrook
pledbrook / BootStrap.groovy
Created May 10, 2012 12:52
Embed Vert.x in Grails
import org.vertx.groovy.core.Vertx
class BootStrap {
def init = { servletContext ->
def vertx = Vertx.newVertx()
def httpServer = vertx.createHttpServer()
vertx.createSockJSServer(httpServer).installApp(prefix: '/events') { sock ->
sock.dataHandler { buff ->
sock << buff
@pledbrook
pledbrook / compile
Created September 21, 2011 08:45 — forked from jesperfj/compile
Grails LP
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>
# fail fast
set -e
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
# parse args
BUILD_DIR=$1
CACHE_DIR=$2