Skip to content

Instantly share code, notes, and snippets.

View lucastex's full-sized avatar

Lucas Frare Teixeira lucastex

View GitHub Profile
@lucastex
lucastex / gist:955169
Created May 4, 2011 12:55
Grails --non-interactive to upgrade plugins automagically
blanq01:simbo blanq01$ grails run-app --non-interactive
Welcome to Grails 1.3.7 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /Users/blanq01/java/grails-1.3.7
Base Directory: /Users/blanq01/Projetos/simbo-workspace/simbo
Resolving dependencies...
Dependencies resolved in 5101ms.
Running script /Users/blanq01/java/grails-1.3.7/scripts/RunApp.groovy
Environment set to development
@lucastex
lucastex / gist:949115
Created April 29, 2011 22:01
Possível maneira de se criar boletos com o plugin do Grails-Stella
def boleto = new BoletoBuilder()
boleto.build(100.00, "itau") {
datas {
vencimento xxx
documento xxx
processamento xxx
}
cedente {
nome xxx
agencia xxx, x
@lucastex
lucastex / Handler.java
Created April 13, 2011 17:38
Reading files from Amazon S3 directly in a java.net.URL object.
package sun.net.www.protocol.s3;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import org.jets3t.service.ServiceException;
import org.jets3t.service.impl.rest.httpclient.RestS3Service;
@lucastex
lucastex / gist:894549
Created March 30, 2011 14:55
Output after running test-app
Tests PASSED - view reports in target/test-reports
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.zip.ZipFile.<init>(ZipFile.java:131)
at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1028)
at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.findNextResource(AntClassLoader.java:147)
at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.<init>(AntClassLoader.java:109)
at org.apache.tools.ant.AntClassLoader.findResources(AntClassLoader.java:975)
at java.lang.ClassLoader.getResources(ClassLoader.java:1041)
@lucastex
lucastex / gist:894526
Created March 30, 2011 14:43
exception when running cobertura
blanq01:platimob blanq01$ grails test-app -coverage -xml
Welcome to Grails 1.3.6 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /Users/blanq01/java/grails-1.3.6
Base Directory: /Users/blanq01/Projetos/platimob
Resolving dependencies...
Dependencies resolved in 4240ms.
Running script /Users/blanq01/java/grails-1.3.6/scripts/TestApp.groovy
Environment set to test
@lucastex
lucastex / gist:885631
Created March 24, 2011 19:01
Somando dias na data
Integer.metaClass.propertyMissing = { name ->
if (name == "day" || name == "days") {
return delegate
} else if (name == "month" || name == "months") {
return delegate * 30
} else if (name == "year" || name == "years") {
return delegate * 30 * 12
} else {
throw new MissingPropertyException(delegate)
@lucastex
lucastex / gist:872497
Created March 16, 2011 13:36
Exemplo de metaprogramação em Groovy
//String - crypt()
String.metaClass.crypt = { ->
return org.apache.commons.codec.digest.DigestUtils.md5Hex(delegate)
}
//String - isNumeric
String.metaClass.isNumeric = { ->
return org.apache.commons.lang.StringUtils.isNumeric(delegate)
}
@lucastex
lucastex / gist:803213
Created January 30, 2011 20:28
[ANN] Grails AWS Plugin v1.1.4
Hello all,
I'm pleased to announce the AWS Grails Plugin, version 1.1.4.1.
Just clarifying, we were in version 0.2, and decided to follow a versioning number strategy that some grails
plugin are using, to follow the 'bundled lib'. So, as AWS Java SDK is on 1.1.4, and this is the first version
of the plugin using it, we're now at 1.1.4.1.
This version fix some bugs, and a bunch of new features, including SES (Simple E-mail Service) integration.
On S3 handling, you can now generate torrent URLs for your s3 hosted files just using the .torrent() method,
@lucastex
lucastex / gist:761154
Created December 31, 2010 17:11
Starting a grails project... The correct way
air:[project] lucastex$ grails stats
Welcome to Grails 1.3.6 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /Users/lucastex/java/grails-1.3.6
Base Directory: /Users/lucastex/workspaces/[project]
Resolving dependencies...
Dependencies resolved in 27ms.
Running script /Users/lucastex/java/grails-1.3.6/scripts/Stats.groovy
Environment set to development
@lucastex
lucastex / gist:636589
Created October 20, 2010 15:07
As 15 coisas que um homem sempre QUIS ouvir. Mas sua mulher NUNCA vai falar:
As 15 coisas que um homem sempre QUIS ouvir. Mas sua mulher NUNCA vai falar:
01. Nossa! Você está tão estressado hoje! Deixa eu fazer sexo oral pra te relaxar.
02. Tem comida demais em casa. Vamos levar só cerveja.
03. Eu acho que você deveria passar a noite com seus amigos... Você merece isso..
04. Que peido incrível! peida de novo!