Skip to content

Instantly share code, notes, and snippets.

View ColinHarrington's full-sized avatar

Colin Harrington ColinHarrington

View GitHub Profile
@ColinHarrington
ColinHarrington / gist:1078341
Created July 12, 2011 16:21 — forked from haydenmuhl/gist:1078293
Grails testing, error when using mockFor
Code:
class RepoControllerTests extends ControllerUnitTestCase {
protected void setUp() {
super.setUp()
}
protected void tearDown() {
super.tearDown()
}
@ColinHarrington
ColinHarrington / gist:1388099
Created November 23, 2011 07:27
shouldFail Should Fail on unexpected Exception
void testShouldFailOnUnexpectedExceptionShouldFail() {
shouldFail {
shouldFail(MyException) {
throw new NullPointerException()
}
}
}
@ColinHarrington
ColinHarrington / .gitconfig
Created January 18, 2012 17:37
git aliases
[alias]
st = status
ci = commit
br = branch
co = checkout
df = diff
lg = log -p
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
@ColinHarrington
ColinHarrington / refit.conf
Created April 2, 2012 17:31
rEFIt configuration file
#
# refit.conf
# Configuration file for the rEFIt boot menu
#
# Timeout in seconds for the main menu screen. Setting the timeout to 0
# disables automatic booting (i.e., no timeout).
#
timeout 5
debugLog4j = {
...
}
prodLog4j = {
...
}
development {
log4j = debugLog4j
@ColinHarrington
ColinHarrington / HTTPBuilder_JSON.groovy
Created July 2, 2012 19:27
GUM JSON + HTTP Builder.
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.2')
import groovyx.net.http.*
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*
def http = new HTTPBuilder( 'http://google.com' ) // Takes URL e.g. http://myservice:8087/
http.request( POST, JSON) { req ->
#!/bin/bash
# Get active window attributes
ACTIVE_WINDOW=$(xdotool getactivewindow)
ACTIVE_GEOMETRY=$(xdotool getwindowgeometry $(xdotool getactivewindow))
ACTIVE_WIDTH=$(echo $ACTIVE_GEOMETRY | cut -d ' ' -f8 | cut -d 'x' -f1)
ACTIVE_HEIGHT=$(echo $ACTIVE_GEOMETRY | cut -d ' ' -f8 | cut -d 'x' -f2)
# Get screen attributes
WIDTH=`xdotool getdisplaygeometry | cut -d' ' -f1`
"Ann Lenczewski (DFL)" <rep.ann.lenczewski@house.mn>
"Diane Loeffler (DFL)" <rep.diane.loeffler@house.mn>
"Greg Davids (R)" <rep.greg.davids@house.mn>
"Sarah Anderson (R)" <rep.sarah.anderson@house.mn>
"Tom Anzelc (DFL)" <rep.tom.anzelc@house.mn>
"Bob Barrett (R)" <rep.bob.barrett@house.mn>
"John Benson (DFL)" <rep.john.benson@house.mn>
"Lyndon Carlson Sr. (DFL)" <rep.lyndon.carlson@house.mn>
"Jim Davnie (DFL)" <rep.jim.davnie@house.mn>
"Steve Drazkowski (R)" <rep.steve.drazkowski@house.mn>
@ColinHarrington
ColinHarrington / RunningFeet.ino
Created June 2, 2013 03:59
Little LED App for my feet during the Electric run. Wished I made the startup sequence a couple minute event instead of just the color scroll
#define PI 3.14159265
#define TWO_PI 6.28318531
int redPin = 5;
int greenPin = 3;
int bluePin = 6;
float hue = 0.0;
float saturation = 1.0;
float brightness = 1.0;
@ColinHarrington
ColinHarrington / gist:7932313
Created December 12, 2013 17:50
Joda-Time Period/months/age example
@Grab(group='joda-time', module='joda-time', version='2.3')
import org.joda.time.*
import org.joda.time.format.*
import java.math.*
LocalDate dob = new LocalDate("1950-06-15")
println dob
Period p1 = new Period(dob, new LocalDate())
Period p2 = new Period(new YearMonth(dob), new YearMonth(new LocalDate()))