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
curl -L http://git.io/nixstall | bash -s get http://download.jboss.org/capedwarf/CapeDwarf_WildFly_2.0.0.CR1.zip |
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
mongoexport --csv -d <db_name> -c <collection> -f <field1,field2,nested.field> |
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
class Person { | |
def name | |
} | |
def add(s){ Person.metaClass."$s" = {-> println "hello"; return delegate} } | |
add("a") | |
add("b") | |
new Person().a().b() |
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
(('A'..'Z') + ('a'..'z') + ('0'..'9')).with { Collections.shuffle(it);it }.take(8).join() |
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
(2006..2014).collate(2,1, false).collect{ it.join("-")}.each { | |
new File(parent, it).mkdir() | |
} | |
// [2006-2007, 2007-2008, 2008-2009, 2009-2010, 2010-2011, 2011-2012, 2012-2013, 2013-2014] |
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
now = Time.now.strftime("%Y%m%d_%H%M%S") | |
# => "20140708_120932" |
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 root = new XmlSlurper().parseText """ | |
<root> | |
<a> | |
<b>b1</b> | |
<b>b2</b> | |
</a> | |
<a> | |
<b>b3</b> | |
<b>b4</b> |
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 slurp(url) {new groovy.json.JsonSlurper().parse(url.toURL())} | |
def slurpText(text) {new groovy.json.JsonSlurper().parseText(text)} |
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
appengine { | |
httpAddress = System.env["IP"]?:"0.0.0.0" | |
httpPort = Integer.parseInt(System.env["PORT"]?:"8080") | |
} |
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
["Groovy", "is", "Awesome"]*.with {[len: length(), down:toLowerCase()]}*.with { "'$down' is $len char long"} |