Skip to content

Instantly share code, notes, and snippets.

View sourcerebels's full-sized avatar

Edu Rodríguez Castillo sourcerebels

View GitHub Profile
@sourcerebels
sourcerebels / HomeController.groovy
Created August 27, 2011 22:29
Grails, simple controller unit test example.
package com.sourcerebels
class HomeController {
def postService
def index = {
[postList: postService.list()]
}
}
@sourcerebels
sourcerebels / setup.cfg
Created August 25, 2011 06:25
Python nosy configuration file
[nosy]
# Paths to check for changed files; changes cause nose to be run
base_path = ./
glob_patterns = *.py
exclude_patterns = *_flymake.*
extra_paths = sample.cfg
# Command line options to pass to nose
options = -x --with-growl
# Command line arguments to pass to nose; e.g. part of test suite to run
tests = *Test*.py
class TestArrayAsVarArgs {
static saludar(def numero, String[] nombres) {
println "Numero " + numero
for (nombre in nombres) {
println "Hola " + nombre
}
}
@sourcerebels
sourcerebels / AgendaSpecification1.groovy
Created July 29, 2011 07:35
Spock Source Rebels Post
import spock.lang.*
def "criterio de aceptacion"() {
setup: "contexto en el que se ejecuta"
expect: "comportamiento que se quiere probar"
where: "casos que se prueban"
}
@sourcerebels
sourcerebels / eachFileRecurse.groovy
Created July 5, 2011 17:03
Recorre la ruta /tmp/ recursivamente y muestra por pantalla la ruta absoluta de cada uno de sus ficheros
new File("/tmp/").eachFileRecurse { file ->
println file.absolutePath
}
@sourcerebels
sourcerebels / findInJars.sh
Created July 5, 2011 14:31
Not very well optimized script for searching recursively with regular expresions in several jar files. TO IMPROVE
#!/bin/bash
function usage() {
echo "usage: findInJars <path> <regexp>"
exit 1
}
[ $# -ne 2 ] && usage
jar=$(which jar)
@sourcerebels
sourcerebels / sendOutputToDevNull.sh
Created July 5, 2011 13:29
Simple shell script for redirecting both standard and error output to /dev/null
#!/bin/bash
[ $# -gt 0 ] && $* > /dev/null 2>&1 &
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
buildscript {
repositories {
mavenCentral()
mavenRepo urls: "http://repository.jboss.org/maven2/"
}
dependencies {
classpath "org.grails:grails-gradle-plugin:1.0",
"org.grails:grails-bootstrap:1.3.7"
}
@sourcerebels
sourcerebels / project.groovy
Created July 4, 2011 08:24
One to Many relationship in GORM (Grails)
package pim
class Project {
static hasMany = [ tasks : Task]
String code
String summary
User owner