Skip to content

Instantly share code, notes, and snippets.

@deluan
deluan / HgInit.groovy
Created August 31, 2010 18:43
Grails script to create a new Mercurial Repository for the current project, and a default .hgignore
/*
* Copyright 2010 Deluan Cotts ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
/*
* Copyright 2010 Deluan Cotts ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@deluan
deluan / grails
Created September 28, 2010 14:00
Script for selecting and calling the correct Grails version when you have more than one version installed
#!/bin/sh
# Author: Deluan (http://techbeats.deluan.com)
# Check if GRAILS_HOME is set
if [ -z "$GRAILS_HOME" -o ! -d "$GRAILS_HOME" ]; then
echo "Error: GRAILS_HOME not set"
exit 2
fi
# Extract the base path from GRAILS_HOME
@deluan
deluan / hudson
Created September 29, 2010 16:10
Init script for Hudson CI Server
#!/bin/bash
#
# Startup script for Hudson
#
# chkconfig: - 84 16
# description: Hudson CI server
# Source function library.
#. /etc/rc.d/init.d/functions
beans = {
log4jConfigurer(org.springframework.beans.factory.config.MethodInvokingFactoryBean) {
targetClass = "org.springframework.util.Log4jConfigurer"
targetMethod = "initLogging"
arguments = ["classpath:myapp/log4j.properties"]
}
...
}
package com.deluan.gaelyk;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
* Wrapper to always return a reference to the Spring Application Context from
* within non-Spring enabled beans. Unlike Spring MVC's WebApplicationContextUtils
* we do not need a reference to the Servlet context for this. All we need is
@deluan
deluan / dependency_pom.xml
Last active October 5, 2016 15:02
Adding shiro-faces taglib to your maven project
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-faces</artifactId>
<!-- See the latest version on the project's homepage -->
<version>2.0</version>
</dependency>
@deluan
deluan / griffon.sh
Created October 31, 2010 03:06
Script for selecting and calling the correct Griffon version when you have more than one version installed
#!/bin/sh
# Author: Deluan (http://techbeats.deluan.com)
# Check if GRIFFON_HOME is set
if [ -z "$GRIFFON_HOME" -o ! -d "$GRIFFON_HOME" ]; then
echo "Error: GRIFFON_HOME not set"
exit 2
fi
# Extract the default version and base path from GRIFFON_HOME
@deluan
deluan / UtilFilters.groovy
Created December 17, 2010 11:52
Grails request profiling example
class UtilFilters {
def filters = {
profiler(controller: '*', action: '*') {
before = {
request._timeBeforeRequest = System.currentTimeMillis()
}
after = {
package com.deluan.grails.util
import java.text.SimpleDateFormat
import com.grailsrocks.cacheheaders.DateFormatterThreadLocal
/**
* This class is used to force CacheHeadersService (from the cache-headers
* plugin) to generate http-dates in english. It MUST be used when the
* locale of your server is not English.
* <p/>