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
//Quick test to check the ComparatorChain in the apache-commons libraries. | |
@Grab(group='commons-collections', module='commons-collections', version='3.0') | |
@Grab(group='commons-beanutils', module='commons-beanutils', version='1.8.3') | |
import org.apache.commons.beanutils.BeanComparator | |
import org.apache.commons.collections.comparators.ComparatorChain | |
import org.apache.commons.collections.comparators.NullComparator | |
class Test { |
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
//useful Groovy example from SpringOne talk by Ken Kousen | |
//hit url using collection for params and display image in swing window | |
import java.awt.BorderLayout as BL | |
import javax.swing.WindowConstants as WC | |
import groovy.swing.SwingBuilder | |
import javax.swing.ImageIcon | |
def base = 'http://chart.apis.google.com/chart?' | |
def params = [cht: 'p3', chs: '400x200', chd: 't:60,40', chl: 'Hello|World'] |
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
/** | |
* | |
* This script pulls all the issues from github for the project in the working directory | |
* and tosses them onto standard out | |
* Prerequisites: configure git with a username: | |
* $ git config --global github.user username | |
* | |
* @author Matt Cholick | |
* | |
* todo: Deal with rate limiting |
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
//Minimal configuration needed for Gradle build file with GMetrics integration | |
apply plugin: 'groovy' | |
repositories { | |
mavenCentral() | |
} | |
configurations { | |
gmetrics | |
} |
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
@Slf4j | |
class RatingServiceIntSpec extends BaseDatabaseIntSpec { | |
RatingService ratingService | |
def setup() { | |
ratingService = injector.getInstance(RatingService.class) | |
} | |
def 'Test that save ratings persists and update'() { |
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 p = ''' | |
@Grab(group='commons-lang', module='commons-lang', version='2.4') import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric | |
File file = new File("${randomAlphanumeric(8)}.groovy").write(p) | |
new GroovyShell(new Binding([p: "def p = ${"'"*3}${p}${"'"*3}; ${p.readLines()[3]}"])).evaluate(p.readLines()[0..2].join(';') as String) | |
'''; new GroovyShell(new Binding([p: "def p = ${"'"*3}${p}${"'"*3}; ${p.readLines()[3]}"])).evaluate(p.readLines()[0..2].join(';') as String) |
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
echo "\n184.72.112.163 reddit.com\n184.72.112.163 www.reddit.com" | sudo tee -a /etc/hosts |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE project SYSTEM "../project-config.dtd"> | |
<project id="project2"> | |
<parameters /> | |
<build-type id="bt4" name="IntelliJ 11.1 (IDEA IC 117-1054)"> | |
<description /> | |
<settings> | |
<parameters /> | |
<build-runners> |
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' | |
repositories { | |
mavenCentral() | |
} | |
configurations { | |
patch | |
[compile, testCompile]*.exclude module: 'jersey-server' | |
} |
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
# Script to initially setup hook globally | |
# For existing repositories, re-run "git init" | |
git config --global init.templatedir '~/.git_template' | |
mkdir -p ~/.git_template/hooks | |
tee > ~/.git_template/hooks/pre-commit << 'EOF' | |
git stash -q --keep-index | |
red=$(tput setaf 1) |
OlderNewer