Skip to content

Instantly share code, notes, and snippets.

View hgmiguel's full-sized avatar

Miguel Angel Huerta Gonzalez hgmiguel

View GitHub Profile
@hgmiguel
hgmiguel / TestController.groovy
Created July 25, 2014 19:32
groovy method missing pattern
def dynamicMethods = [
[regex:"hasPermission(.*)", method:this.&hasPermission],
[regex:"create(.*)Permission", method:this.&createPermission]]
def methodMissing(String name, args) {
def method = dynamicMethods.find { name =~ it.regex}
if(method) {
def match = name =~ method.regex
return method.method(match[0][1], * args)
} else
@hgmiguel
hgmiguel / with example
Created May 22, 2014 14:26
beautifull sql
with temp as (select d_codigo
from (select d_codigo,d_estado, length(d_codigo)
from colonia_tmp
group by d_codigo,d_estado
having length(d_codigo) = 4) newcode)
update colonia_tmp set d_codigo= '0' || d_codigo where d_codigo in (select d_codigo from temp);