Skip to content

Instantly share code, notes, and snippets.

View lhotari's full-sized avatar

Lari Hotari lhotari

View GitHub Profile
@lhotari
lhotari / JsonWorkaroundBootStrap.groovy
Created November 22, 2013 09:35
GRAILS-10823 workaround. add this file to grails-app/conf directory
import org.codehaus.groovy.grails.web.json.JSONObject
class JsonWorkaroundBootStrap {
def init = { servletContext ->
// activate workaround for GRAILS-10823
println("activating workaround for GRAILS-10823 - use this only for Grails 2.3.3")
org.springframework.util.ReflectionUtils.findField(JSONObject, "useStreamingJavascriptEncoder").with {
accessible = true
set(null, false)
}
@lhotari
lhotari / add_modes_to_screen.sh
Created May 24, 2013 13:16
script for adding standard modes to beamer for presenting on linux
#!/bin/bash
# script for adding standard modes to beamer for presenting on linux
# use xrandr to find out screen name of external output port
# xrandr is in x11-xserver-utils package on debian/ubuntu
SCREENNAME=$1
if [ -z "$SCREENNAME" ]; then
SCREENNAME=VGA-0
fi
function addmode() {
xrandr --newmode `cvt $1 $2 |grep Modeline | sed -e 's/^Modeline //' | sed -e 's/\"//g'`
@lhotari
lhotari / PatchedHibernatePluginSupport.groovy
Created September 28, 2012 19:59
GRAILS-9411 and GRAILS-9412 monkey patch for Grails 2.1.1
// src/groovy/grailspatch/PatchedHibernatePluginSupport.groovy
/*
* Copyright 2004-2005 the original author or authors.
*
* 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
*
@lhotari
lhotari / DeltaStateMapDecorator.java
Created September 27, 2010 05:53
Map decorator that stores the state of map changes and doesn't change the original decorated map
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;