Skip to content

Instantly share code, notes, and snippets.

@erdi
erdi / keybase.md
Last active February 6, 2023 15:01

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@erdi
erdi / gist:5998861
Created July 15, 2013 10:08
Because Erik is a crazy cat....
addListener(new TaskExecutionListener() {
void afterExecute(Task task, TaskState state) {
if (task in AbstractArchiveTask) {
println "\nOutput location: ${task.outputs.files.singleFile}\n"
}
}
void beforeExecute(Task task) {}
})
@erdi
erdi / gist:5998112
Created July 15, 2013 07:41
Show output location for all archive generating tasks in gradle
allprojects {
tasks.withType(AbstractArchiveTask) { task ->
task.doLast {
println "\nOutput location: ${task.outputs.files.singleFile}\n"
}
}
}
module hello.World
function main = |args| {
println("Hello world!")
class A {
String value
}
def list = [new A(value: 'a'), new A(value: 'b'), new A(value: 'c'), new A(value: 'd')]
//we don't know the order and what is in list, we want to move object with value 'c' to the beggining of the list
def moved = list.find { it.value == 'c' }
list.remove(moved)
list.putAt(0, moved)
@erdi
erdi / gist:1031051
Created June 17, 2011 08:05
MetaClassMixin
import grails.test.GrailsUnitTestCase
@Category(GrailsUnitTestCase)
class MetaClassMixin {
Delegate metaClassFor(Class clazz) {
registerMetaClass(clazz)
new Delegate(target: clazz.metaClass)
}