Skip to content

Instantly share code, notes, and snippets.

@deluan
deluan / gist:4240301
Created December 8, 2012 13:39 — forked from apretto/robot.js
Delete Me
We couldn’t find that file to show.
@deluan
deluan / gist:4237203
Created December 7, 2012 22:55 — forked from bltavares/robot.js
Delete Me
We couldn’t find that file to show.
@deluan
deluan / gist:4236007
Created December 7, 2012 19:53 — forked from fwitzke/robot.js
Delete Me
We couldn’t find that file to show.
public class WCC2012_23 {
Expression bestSolution = null
BigDecimal target = null
List list
enum Operation {
plus('+'), minus('-'), multiply('*'), div('/')
String symbol
@deluan
deluan / attendees2csv.groovy
Created December 11, 2011 22:09
Script to export attendees from an Facebook Event ICS (iCalendar) file to a CSV file.
#!/usr/bin/env groovy
import java.util.regex.*
def inviteFileName = args[0]
def inviteFile = new File(inviteFileName)
def pattern = Pattern.compile('^ATTENDEE;CN=(.*);PARTSTAT=ACCEPTED:(.*)')
inviteFile.eachLine { line ->
def m = pattern.matcher(line)
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/>
@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 = {
@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
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
beans = {
log4jConfigurer(org.springframework.beans.factory.config.MethodInvokingFactoryBean) {
targetClass = "org.springframework.util.Log4jConfigurer"
targetMethod = "initLogging"
arguments = ["classpath:myapp/log4j.properties"]
}
...
}