Skip to content

Instantly share code, notes, and snippets.

View tbarker9's full-sized avatar

Tommy Barker tbarker9

  • University of Pennsylvania Libraries
  • Philadelphia
View GitHub Profile
@tbarker9
tbarker9 / mdocBasics.groovy
Created October 21, 2013 15:18
basic mdoc script for @TApicella
import metridoc.core.Step
step(foo: "I am foo") {
println "I am from foo"
}
step(bar: "I am bar") {
depends "foo"
println "I am from foo"
@tbarker9
tbarker9 / LdapExample.groovy
Last active December 19, 2015 23:09
A basic ldap example so I don't have to keep looking this up
import javax.naming.Context
import javax.naming.directory.InitialDirContext
import javax.naming.directory.SearchControls
/**
* Created with IntelliJ IDEA on 7/18/13
* @author Tommy Barker
*/
def config = new ConfigSlurper().parse(new File("${System.getProperty("user.home")}/.metridoc/MetridocConfig.groovy").toURI().toURL())
@tbarker9
tbarker9 / gist:5825298
Last active December 18, 2015 18:19
bintray generic upload gradle task. Stole directly from https://github.com/pledbrook/lazybones
class BintrayGenericUpload extends DefaultTask {
@InputFile
File artifactFile
@Input
String artifactUrl
@TaskAction
def publish() {
@tbarker9
tbarker9 / gist:5684208
Created May 31, 2013 10:45
upload to bintray gradle task. Probably should consider making this a gradle plugin
task uploadToBintray(dependsOn: ["prepareForBintrayUpload", "publishBintrayPackages"])
task prepareForBintrayUpload << {
if (version.contains("SNAPSHOT")) {
println "bintray does not support SNAPSHOTs, skipping upload to bintray"
uploadArchives.enabled = false
publishBintrayPackages.enabled = false
return
}
@tbarker9
tbarker9 / gist:5629664
Created May 22, 2013 18:14
Convert xml to pojo to json using groovy
import groovy.json.JsonBuilder
//make sure you have installed groovy
//best way to install groovy: http://gvmtool.net/
def carRecords = '''
<records>
<car name='HSV Maloo' make='Holden' year='2006'>
<country>Australia</country>