Skip to content

Instantly share code, notes, and snippets.

View lucastex's full-sized avatar

Lucas Frare Teixeira lucastex

View GitHub Profile
@lucastex
lucastex / grails_twitter.groovy
Created March 3, 2009 02:47
Using Grails Twitter plugin to update your status
def twitterService
(...)
def updateTwitterStatus = {
twitterService.setStatus "My new status..." //probably would be something like params.newStatus
redirect action: index //or your usual action
}
class Pessoa {
String nome
String cpf
static constraints = {
nome()
cpf(cpf:true)
}
}
class Pessoa {
String nome
String cpf
static constraints = {
nome()
cpf(cpf:[formatted:true])
}
}
class Empresa {
String razaoSocial
String cnpj
static constraints = {
razaoSocial()
cnpj(cnpj:true)
}
}
class Empresa {
String razaoSocial
String cnpj
static constraints = {
razaoSocial()
cnpj(cnpj:[formatted:true])
}
}
class Pessoa {
String nome
String nit
static constraints = {
nome()
nit(nit:[formatted:true])
}
}
class Pessoa {
String nome
String nit
static constraints = {
nome()
nit(nit:true)
}
}
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
import java.util.zip.*
import org.tmatesoft.svn.core.internal.io.dav.*
import org.tmatesoft.svn.core.wc.*
import org.tmatesoft.svn.core.*
@Grab(group='com.svnkit', module='svnkit', version='1.1.0')
def setup(projectName) {
File.metaClass.plus = { String c -> new File(delegate, c) }
private buildObjectList(List assets, S3Service s3) {
def objs = []
assets.each {a ->
S3Object obj = new S3Object()
if (a.localPath) {
File f = new File(a.localPath)
obj.setDataInputFile(f)
obj.setContentLength(f.size())
}
//TODO support completely custom acls, need to persist xml or some kind of model