Skip to content

Instantly share code, notes, and snippets.

@robpurcell
robpurcell / gist:8391335
Created January 12, 2014 22:11
Iterate through days in a Joda-Time Interval using Groovy
DateTime.metaClass.next << { -> delegate.plusDays(1) }
Interval interval = ...
def start = interval.start
def finish = interval.end
for (day in start..finish) {
// ...
}
@robpurcell
robpurcell / gist:3734502
Created September 16, 2012 21:37
Create a new Scala project layout using giter8 (interactive)
g8 chrislewis/basic-project
@robpurcell
robpurcell / build.gradle
Created July 14, 2012 09:54
Minimal Gradle Build file for Groovy project creation
apply plugin: 'groovy'
apply plugin: 'idea'
task initProject(description: 'Initialize project directory structure.') << {
// Default package to be created in each src dir.
def defaultPackage = 'com/robbyp/greg'
['java', 'groovy', 'resources'].each {
// convention.sourceSets contains the directory structure
// for our Groovy project. So we use this struture
@robpurcell
robpurcell / build.gradle
Created June 29, 2012 13:44
Handy Gradle build file snippet for creating a Scala project layout
// Based on http://mrhaki.blogspot.co.uk/2009/11/using-gradle-for-mixed-java-and-groovy.html
// Updated for Gradle 1.0
// Thanks Mr Haki!!
apply plugin: 'scala'
task initProject(description: 'Initialize project directory structure.') << {
// Default package to be created in each src dir.
def defaultPackage = 'com/robbyp/project'