Skip to content

Instantly share code, notes, and snippets.

@tfnico
tfnico / build.gradle
Created August 14, 2012 07:06
Example Gradle build that fails with missing property, even though it's not used in the invoked task
task release << {
println "Releasing version ${version}"
}
task buildBranch << {
println "Building branch ${branch}"
}
task tagBuildRepo(type: Exec) {
commandLine 'git', 'tag', "${tag}"
@tfnico
tfnico / camelbot.sh
Created July 9, 2012 11:44
init script for camelbot
#!/bin/sh
dir="/opt/flurfunk/camelbot"
user="jenkins"
cmd="sh /opt/flurfunk/camelbot/flurfunk-camelbot-1.0-SNAPSHOT/bin/camelbot"
name=`basename $0`
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
@tfnico
tfnico / build.gradle
Created July 5, 2012 08:07
Why are the dependency trees different?
apply plugin: 'maven'
apply plugin: 'java'
repositories {
maven {
url "http://repo1.maven.org/maven2"
}
}
dependencies {
@tfnico
tfnico / init-stuff.sh
Created July 4, 2012 20:44
Me and @fhd's trygit.org tutorial
#!
cd /tmp
mkdir stuff
cd stuff
echo "Chapter one: it was a cold and stormful night" > essay.txt
cp essay.txt essay.new.txt
echo "Chapter two: The Commitments" >> essay.new.txt
cp essay.new.txt essay.txt.bob
echo "Chapter three: And then along came the butler" >> essay.txt.bob
cp essay.new.txt essay-2011.10.12.txt
@tfnico
tfnico / encodings.txt
Created June 12, 2012 10:47
Testing encoding in filenames on git
First, check in a file on OSX:
➜ ~/projects/agnes/[master]>touch fæøå.txt tfnico@thomas-ferris-nicolaisens-imac [12:34:38]
➜ ~/projects/agnes/[master]✗>ls tfnico@thomas-ferris-nicolaisens-imac [12:34:56]
agnes.iml build.xml funky fæøå.txt macroman.txt pom.xml readme.txt src target
➜ ~/projects/agnes/[master]✗>git st tfnico@thomas-ferris-nicolaisens-imac [12:34:58]
# On branch master
# Untracked files:
#
@tfnico
tfnico / _Events.groovy
Created January 18, 2012 14:59
Our hacky workaround of Grails' lacking snapshot dependency mechanism
/**
* Libify version 1.0
*
* Copyright (C) 2012 Viaboxx Systems GmbH
*
* This is a copy of our base _Events.groovy script that serves in all our Grails plugins/projects.
*
* It goes into the "scripts" folder of a Grails project.
*
* NOTE: It requires a maven-ant-tasks-2.1.3.jar in your project, in a folder called "build-lib".
@tfnico
tfnico / BuildConfig.groovy
Created December 30, 2011 11:40
Problems with grails-snapshots
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.dependency.resolution = {
inherits "global" // inherit Grails' default dependencies
log "verbose" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
repositories {
grailsPlugins()
@tfnico
tfnico / ifelse.java
Created December 23, 2011 00:18
Some business rule tests
public static boolean isCodeAllowed(String code) {
return isNotNullOrEmpty(code) &&
onlyLettersCorrectLength(code) &&
lettersAndNumbersCorrectLength(code) &&
numbersOnlyNotAllowed(code) &&
plusSignOnlyParticularity(code);
}
@tfnico
tfnico / Tjohei.java
Created December 5, 2011 13:53
Splitting tests
@Test(expected=NullPointerException.class)
public void psmThrowsNullPointerExceptionWhenCopying() {
Aristo a = new Aristo();
Runtime r = mock(Runtime.class);
a.setRuntime(r);
a.PSMCopy("oldPSM", "newPSM");
}
@Test(expected=IOException.class)
public void psmThrowsIOExceptionWhenExecuting() {
@tfnico
tfnico / gof.clj
Created December 3, 2011 19:52
Started Clojure game-of-life
(ns conways.test.core
(:use [conways.core])
(:use [clojure.test]))
(def world #{})
(defn isALive? [world x y] (get world [x y]) )
(defn setLive [world x y] (conj world [x y]))