This file contains hidden or 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 org.apache.aries.blueprint.annotation.* | |
| @Inject studentService | |
| get("/students/:id") { | |
| def student = studentService.get(urlparams.id) | |
| "Hello, ${student.name}" | |
| } |
This file contains hidden or 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
| {"slot-request": | |
| {"date": "2010-01-04", "doctor": "mjones"} | |
| } | |
| {"slots":[ | |
| {"start":"1400", "end":"1450", "doctor":"mjones"}, | |
| {"start":"1600", "end":"1650", "doctor":"mjones"} | |
| ]} |
This file contains hidden or 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
| // A Spock spec to test ZK that I'd like to see. | |
| spec "Test ZK" { | |
| setup: | |
| testFor("a.zul") | |
| when: | |
| $('btnTest').click() | |
| then: |
This file contains hidden or 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
| #!/usr/bin/env groovy | |
| @Grab('org.jsoup:jsoup:1.6.1') | |
| import static org.jsoup.Jsoup.* | |
| def doc = connect("http://www.gogoanime.com").get() | |
| def table = doc.select('#content > div.post > div > table') | |
| println table[1].select('td')[0].select('li').collect { it.text() }.join('\n') |
This file contains hidden or 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 zello.* | |
| import org.hibernate.transform.AliasToEntityMapResultTransformer | |
| new Task(subject:'test 222').save() | |
| Task.createCriteria().get { | |
| projections { | |
| countDistinct('subject', 'count') | |
| } | |
| resultTransformer(AliasToEntityMapResultTransformer.INSTANCE) |
This file contains hidden or 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
| class CategoryComposer extends GrailsComposer { | |
| def afterCompose = { window -> | |
| $('#units').append { | |
| for(u in Uom.findAll()) { | |
| comboitem(label: u, value: u) | |
| } | |
| } |
This file contains hidden or 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
| class CheckboxComposer extends GrailsComposer { | |
| def afterCompose = { | |
| $('button').on('click', { | |
| for(cb in $('checkbox[checked=true]')) { | |
| alert(cb.label + " :: " + cb.checked) | |
| } | |
| }) | |
| } |
This file contains hidden or 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
| composer = testFor(ProductComposer, "product.zul") | |
| composer.afterCompose(composer.root) | |
| $('#name').ok() | |
| assert $('#category').is(':focus') == true | |
| mock(Category).static.findAll().returns(["A", "B"]) | |
| play { | |
| $('#category').load(Category.findAll()) |
This file contains hidden or 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
| static String preprocess(query) { | |
| query.replaceAll(/:(eq|lt|gt|even|odd)(\(.*?\))?/, { m, s, x -> | |
| if(x) { x = x[1..-2] } | |
| switch(s) { | |
| case "eq": return ":nth-child(${x.toInteger()+1})" | |
| case "lt": return ":nth-child(-n+${x})" | |
| case "gt": return ":nth-child(n+${x})" | |
| case "even": return ":nth-child(2n)" | |
| case "odd": return ":nth-child(2n+1)" | |
| } |
This file contains hidden or 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 results = TaskList.list() - TaskList.where { | |
| tasks { | |
| priority == 0L && done == false | |
| } | |
| }.list() | |
| /** | |
| def TaskList.where { | |
| notExists { | |
| tasks { | |
| priority == 0L && done == false |