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 Predicate { | |
boolean value | |
boolean asBoolean() { value } | |
} | |
// Works: | |
assert new Predicate(value: true) | |
assert !new Predicate(value: false) | |
assert (new Predicate(value: true) as Boolean == true) | |
assert (new Predicate(value: false) as Boolean == false) |
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 | |
/* setgrails: Script used to easily change grails version on the commandline in OS X | |
* | |
* My setup: | |
* /User/leo/Apps/grails Folder where all versions of grails are installed | |
* /User/leo/Apps/grails/grails A symlink pointing to the version of grails I'm currently using | |
* /User/leo/Apps/grails-1.3.1 One of the installed versions | |
* | |
* in ~/.profile |
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 | |
assert args.size() == 1 : "Specify the path of the folder that needs placeholders." | |
def projectFolder = new File(args[0]) | |
projectFolder.eachDirRecurse { dir -> | |
if(dir.list().size() == 0) { | |
def placeholder = new File(dir, '.PLACEHOLDER') | |
println "Creating: $placeholder.absolutePath" | |
placeholder.createNewFile() |
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 javax.swing.* | |
def showTimeredMessage(String message, int afterSeconds = 600) { | |
sleep (afterSeconds*1000) | |
JOptionPane.showMessageDialog(null, message) | |
} | |
showTimeredMessage("Pomodoro over, get back to work! :)", 300) |
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 exampleXmlString = '''<?xml version="1.0" encoding="UTF-8"?> | |
<persons> | |
<person> | |
<name>John</name> | |
<lastname>Doe</lastname> | |
<age>38</age> | |
</person> | |
</persons>''' | |
def exampleXml = new XmlParser().parseText(exampleXmlString) |
NewerOlder