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
Get a File | |
curl -i -X GET -H 'Authorization: token <your token>' -d '{"path": "index.html", "message": "Initial Commit", "committer": {"name": "Jonatas Emidio", "email": "jonatasemidio@gmail.com"}, "branch": "master"}' https://api.github.com/repos/jonatasemidio/blog/contents/index.html | |
Create a File | |
curl -i -X PUT -H 'Authorization: token <your token>' -d '{"path": "index.html", "message": "Initial Commit", "committer": {"name": "Jonatas Emidio", "email": "jonatasemidio@gmail.com"}, "content": "VGVzdGluZyBHaXRIdWIgQVBJ", "branch": "master"}' https://api.github.com/repos/jonatasemidio/blog/contents/index.html | |
Update a File | |
curl -i -X PUT -H 'Authorization: token <your token>' -d '{"path": "index.html", "message": "Initial Commit", "committer": {"name": "Jonatas Emidio", "email": "jonatasemidio@gmail.com"}, "content": "VGVzdGluZyBHaXRIdWIgQVBJ", "sha":"2706f84a7078ad64fbdca10558879e6f2c323694", "branch": "master"}' https://api.github.com/repos/jonatasemidio/blog/contents/index.html | |
Delete a File |
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
f = new File('dir_file_'+ System.currentTimeMillis() +'.log') | |
new File('.').eachFileRecurse { f << it.getCanonicalPath() + '\n' } |
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
REGEX = "^[\\w\\s/<>?\".=-]*[áéíóúçàãõâêô:\\s]*\$" | |
nome = " jonatas#!@#%¨&* emidio" | |
texto = ''' | |
<?xml¨&*()¨&*( version="1.0" encoding="ISO-8859-1"?> | |
<SAIDA> | |
<HEADER> | |
<ERRO> | |
<CODIGO-ERRO>1454014207309</CODIGO-ERRO>%¨&*() | |
<ORIGEM-ERRO>The data "" is not legal for a JDOM character content 0x0 is not a legal XML character.</ORIGEM-ERRO> |
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
// Font: http://mrhaki.blogspot.fr/2015/09/groovy-goodness-removing-elements-from.html | |
// Thanks to Hubert Klein Ikkink (https://github.com/mrhaki) | |
def list = ['Groovy', 42, 'gr8!', 5.2, new Date()] | |
// Groovy adds retainAll method | |
// to remove items from collection | |
// that do not apply to the condition we | |
// define in the closure and keep those | |
// items that do apply to the condition. |
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
// Font: http://mrhaki.blogspot.fr/2015/09/groovy-goodness-removing-elements-from.html | |
// Thanks to Hubert Klein Ikkink (https://github.com/mrhaki) | |
def list = ['Groovy', '=', 'gr8!'] | |
// Groovy adds removeAll method | |
// to remove items from collection | |
// that apply to the condition we | |
// define in the closure. | |
list.removeAll { it.toLowerCase().startsWith('g') } |
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
//Based on https://gist.github.com/israelst/2041698 | |
//See it working http://groovyconsole.appspot.com/script/1265001 | |
def dv(x, y){ | |
result = [q : 0, r : 0] | |
while (x >= y){ | |
x -= y | |
result.q += 1 | |
} | |
result.r = x |
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
//Let see with an example: | |
class Counter { | |
public static long count = 0; | |
} | |
class UseCounter implements Runnable { | |
public void increment() { | |
Counter.count++; | |
System.out.print(Counter.count + " "); |
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 fizzbuzz(n): | |
if n % 3 == 0 and n % 5 == 0: | |
return 'FizzBuzz' | |
elif n % 3 == 0: | |
return 'Fizz' | |
elif n % 5 == 0: | |
return 'Buzz' | |
else: | |
return str(n) |
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
Graeme Rocher: Grails Project Lead (CTO) | |
----------------------------------------------------------------------------------------------------------------------------- | |
Links: | |
1º post do Graeme Rocher falando sobre grails: | |
http://graemerocher.blogspot.com.br/search?updated-max=2006-03-15T20:48:00Z&max-results=20&start=140&by-date=false | |
1º Commit no Github: | |
https://github.com/grails/grails/commit/25e0b852c9b39895fa9b831ac4a7e15a40472341 | |
Repositório SVN (Antigo): |
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
import grails.test.mixin.TestFor | |
@TestFor(DadosService) | |
class DadosServiceTests { | |
void test_obtemDados() { | |
def dadosBuscasService = new DadosBuscasService() | |
def result = ['CVT', '2', '2', 'AAAA', 'Grat'] | |
def sqlUtilService = [select: {result}] as SqlUtilService | |
dadosBuscasService.sqlUtilService = sqlUtilService |