This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93#GO#ABADIA DE GOIAS #52137 | |
50#MG#ABADIA DOS DOURADOS #24622 | |
93#GO#ABADIANIA #24615 | |
50#MG#ABAETE #28989 | |
17#PA#ABAETETUBA #5603 | |
32#CE#ABAIARA #5586 | |
39#BA#ABAIRA #2448 | |
39#BA#ABARE #33682 | |
73#PR#ABATIA #15758 | |
75#SC#ABDON BATISTA #44918 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l = [ | |
"MUNICIPIO.put(\"50830\",\"1\"); ", | |
"MUNICIPIO.put(\"9465\" ,\"2\"); ", | |
"MUNICIPIO.put(\"35697\",\"3\"); ", | |
"MUNICIPIO.put(\"50919\",\"4\"); ", | |
"MUNICIPIO.put(\"50971\",\"5\"); ", | |
"MUNICIPIO.put(\"35680\",\"6\"); ", | |
"MUNICIPIO.put(\"50964\",\"7\"); ", | |
"MUNICIPIO.put(\"15978\",\"8\"); ", | |
"MUNICIPIO.put(\"50957\",\"9\"); ", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
VERSÃO PARA SERES HUMANOS | |
No dia 18/03/2015 a Galera do DojoRio resolveuresolver o problema o jokenpo elevado a sheldon cooper. O resultado ofi um dojo com várias risadas e um resultado bem antes das 211:00 da noite. | |
*/ | |
plays = ['scissor', 'paper', 'rock', 'lizard', 'spock'] | |
def play(play1, play2){ | |
warning = {i, n -> (i + n) % 5} | |
position = plays.indexOf(play1) | |
play1 == play2 ? 'draw' : play2 in [plays[warning(position, 1)] , plays[warning(position, 3)]] ? 'play1' : 'play2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@IdClass(PersonKey.class) | |
public class Person{ | |
@Id | |
int taxid; | |
@Id | |
String countryCd; | |
@Transient | |
PersonKey key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d=[:];n='';r='' | |
g = 'ejp mysljylc kd kxveddknmc re jsicpdrysi rbcpc\nypc rtcsra dkh wyfrepkym veddknkmkrkcd\nde kr kd eoya kw aej tysr re ujdr lkgc jvqz' | |
e = 'our language is impossible to understand there\nare twenty six factorial possibilities\nso it is okay if you want to just give upzq' | |
g.eachWithIndex{s,i->d+=["${s}":e[i]]} | |
def tc(def s){d.find{it.key==s}.value} | |
def tl(def l){l.each{n += tc(it)};return n} | |
g.split('\\n').eachWithIndex{s,i->r+="Case #${i+1}: ${tl(s)}\n"} | |
r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mdc(a, b) { return (b == 0) ? a : mdc (b, a%b) } | |
mdc 252, 105 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//def mdc(a, b) { return (b == 0) ? a : mdc (b, a%b) } | |
//mdc 252, 105 | |
def mdcx(a, b){ | |
def r=a; r1=b; u=1; v=0; u1=0; v1=1; | |
def rs, us, vs, q; | |
while ( r1 != 0 ) { | |
q = r/r1 as int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def testSwitch(val) { | |
def result | |
switch (val) { | |
case ~/^Switch.*Groovy$/: | |
result = 'Pattern match' | |
break | |
case BigInteger: | |
result = 'Class isInstance' | |
break | |
case 60..90: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//post sobre o código - http://mrhaki.blogspot.com.br/2009/08/groovy-goodness-grep-method.html | |
assert [true] == ['test', 12, 20, true].grep(Boolean), 'Class isInstance' | |
assert ['Groovy'] == ['test', 'Groovy', 'Java'].grep(~/^G.*/), 'Pattern match' | |
assert ['b', 'c'] == ['a', 'b', 'c', 'd'].grep(['b', 'c']), 'List contains' | |
assert [15, 16, 12] == [1, 15, 16, 30, 12].grep(12..18), 'Range contains' | |
assert [42.031] == [12.300, 109.20, 42.031, 42.032].grep(42.031), 'Object equals' | |
assert [100, 200] == [10, 20, 30, 50, 100, 200].grep({ it > 50 }), 'Closure boolean' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab( 'com.googlecode.gbench:gbench:0.3.0-groovy-2.0' ) | |
import gbench.* | |
def i = 0 | |
new BenchmarkBuilder().run( measureCpuTime:true ) { | |
'TEST:' { | |
1000000.times{i?.toLong() ? i?.toLong() : null} | |
} | |
'TEST:' { |