Skip to content

Instantly share code, notes, and snippets.

View cholick's full-sized avatar
:shipit:

Matt Cholick cholick

:shipit:
View GitHub Profile
@cholick
cholick / init.sh
Last active August 29, 2015 13:56
Pre-commit hook to check for Spock @ignore annotation
# 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)
@cholick
cholick / .zshrc
Last active August 29, 2015 14:02
alias fjson="pbpaste | python -m json.tool | pbcopy; pbpaste"
alias servedir="python -m SimpleHTTPServer"
function setjdk() { if [ $# -ne 0 ];then export JAVA_HOME=`/usr/libexec/java_home -v $@`; fi; java -version; }
function lsjdk() { ls -1 /System/Library/Java/JavaVirtualMachines/; ls -1 /Library/Java/JavaVirtualMachines/; }
killport() {
if [ -z $1 ]; then
echo 'Port is required. Usage: "killport 8000"';
return
fi
local pid=`lsof -i :$1 | grep LISTEN | awk '{print $2}'`
@cholick
cholick / build.gradle
Created November 1, 2014 16:09
Verify failure Gradle fix
compileGroovy {
groovyOptions.forkOptions.jvmArgs = ['-noverify']
}
test {
jvmArgs '-noverify'
}
//applicationDefaultJvmArgs = ['-noverify']
import java.util.concurrent.ConcurrentLinkedQueue
def results = new XmlSlurper().parse(
'http://www.howstuffworks.com/podcasts/stuff-you-should-know.rss'.toURL().openStream()
)
ConcurrentLinkedQueue<String> queue = new ConcurrentLinkedQueue<String>()
public void download(String address) {
new File("downloads/${address.tokenize('/')[-1]}.mp3").withOutputStream { out ->
@cholick
cholick / keybase.md
Created March 2, 2015 03:06
keybase.md

Keybase proof

I hereby claim:

  • I am cholick on github.
  • I am cholick (https://keybase.io/cholick) on keybase.
  • I have a public key whose fingerprint is A876 B5BE 5828 CC9E 2D73 5246 D68C 017E 4DF9 A20B

To claim this, I am signing this object:

@cholick
cholick / gist:2029461
Created March 13, 2012 15:38
Testing apache-commons ComparatorChain
//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 {
@cholick
cholick / gist:2067147
Created March 18, 2012 00:45
Groovy example from Ken Kousen, hit url using collection for params and display image in swing window
//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']
@cholick
cholick / github_issues.groovy
Created March 21, 2012 05:08
Script to export issues with comments for a github project
/**
*
* 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
@cholick
cholick / build.gradle
Created June 10, 2012 00:50
Gradle task for gmetrics
//Minimal configuration needed for Gradle build file with GMetrics integration
apply plugin: 'groovy'
repositories {
mavenCentral()
}
configurations {
gmetrics
}
@cholick
cholick / RatingServiceIntSpec.groovy
Created August 8, 2012 02:10
Example Spock Test
@Slf4j
class RatingServiceIntSpec extends BaseDatabaseIntSpec {
RatingService ratingService
def setup() {
ratingService = injector.getInstance(RatingService.class)
}
def 'Test that save ratings persists and update'() {