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 groovy.xml.StreamingMarkupBuilder | |
def inputs = ['FirstName', 'LastName', 'Street', 'City', 'Country'] | |
def controller = 'formController' | |
def bean = 'formBean' | |
def builder = new StreamingMarkupBuilder() | |
builder.encoding = "UTF-8" | |
def doc = builder.bind { | |
mkp.xmlDeclaration() |
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
#!/usr/bin/env groovy | |
import ca.odell.glazedlists.* | |
import ca.odell.glazedlists.gui.* | |
import ca.odell.glazedlists.swing.* | |
import groovy.swing.* | |
import javax.swing.* | |
@Grab (group = 'net.java.dev.glazedlists', module = 'glazedlists_java15', version = '1.8.0') | |
public class SVNGlazedListExample | |
{ |
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 org.jdesktop.swingx.JXTable | |
import javax.swing.* | |
@Grab(group='org.swinglabs', module='swingx', version='0.9.3') | |
@Grab(group='org.ccil.cowan.tagsoup', module='tagsoup', version='0.9.7') | |
def getHtml(url) { | |
def parser = new XmlParser(new org.ccil.cowan.tagsoup.Parser()) | |
parser.parse(url) | |
} | |
def data = [ ] |
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(group='net.homeip.yusuke', module='twitter4j', version='2.0.10') | |
import twitter4j.Twitter | |
def getHomeTimeline() { | |
Console cons = System.console() | |
def getUsername = { cons.readLine( 'Enter a username: ' ).trim() } | |
def getPassword = { cons.readPassword( "Enter a password: ").toString()} | |
def twitter = new Twitter(getUsername(),getPassword()) | |
def response = twitter.getHomeTimeline() | |
response.each {status ->println "${status.text} FROM ${status.user.name} and SOURCE ${status.source}"; println ""} |
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
println new XmlSlurper().parse('http://feeds.dzone.com/dzone/frontpage'.toURL().content) | |
.depthFirst() | |
.findAll {(it.name()=='title'&&it.parent().name()=='item')}[0..5] |
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
apply plugin: 'groovy' | |
apply plugin: 'idea' | |
apply plugin: 'maven' | |
apply plugin: 'eclipse' | |
apply plugin: 'project-report' | |
version = '1.0-SNAPSHOT' | |
group = '' | |
versions = [ |
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
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.codehaus.groovy.maven</groupId> | |
<artifactId>gmaven-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>generate-resources</phase> | |
<goals> | |
<goal>execute</goal> |
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 company = new Expando() | |
[500000, 399999, 1000000].each{ hops -> | |
company.hops = hops | |
switch(company.hops) | |
{ | |
case 0..99999 : | |
company.rating = 1 | |
break | |
case 100000..399999 : |
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
#!/usr/bin/env groovy | |
// searchJdk7ApiDocsForSince17.groovy | |
@Grab(group='org.ccil.cowan.tagsoup', module='tagsoup', version='0.9.7') | |
@Grab(group='org.codehaus.gpars', module='gpars', version='0.11') | |
import groovyx.gpars.GParsPool | |
import java.util.concurrent.atomic.AtomicInteger | |
def xml = new XmlParser(new org.ccil.cowan.tagsoup.Parser()).parse("http://download.oracle.com/javase/7/docs/api/allclasses-frame.html") | |
def urls = xml.'**'.a.@href |
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
/** | |
* Add a rule that supports executing tests based on a series of comma delimited patterns(ant glob patterns). | |
*/ | |
tasks.addRule("Pattern: testMulti<Name>,<Name2> will test **/<Name>.class,**/<Name2>.class") {String taskName -> | |
if (taskName.startsWith("testMulti")) | |
{ | |
tasks.add(taskName).dependsOn(test) | |
test.includes = taskName.substring(9).split(',').collect {"**/${it}.class"} | |
} | |
} |
OlderNewer