Skip to content

Instantly share code, notes, and snippets.

View kellyrob99's full-sized avatar

Kelly Robinson kellyrob99

View GitHub Profile
@kellyrob99
kellyrob99 / gradle-dependency-analyze.gradle
Created December 19, 2012 05:00 — forked from anonymous/gradle-dependency-analyze.gradle
A simple Gradle wrapper for the maven dependency:analyze goal
import org.apache.maven.shared.dependency.analyzer.ClassAnalyzer
import org.apache.maven.shared.dependency.analyzer.DefaultClassAnalyzer
import org.apache.maven.shared.dependency.analyzer.DependencyAnalyzer
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis
import org.apache.maven.shared.dependency.analyzer.asm.ASMDependencyAnalyzer
import org.gradle.api.Project
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.artifacts.ResolvedArtifact
import org.gradle.api.artifacts.ResolvedDependency
@kellyrob99
kellyrob99 / scalaInstaller.groovy
Created December 2, 2012 01:20
Scala install script for Mac OSX Mountain Lion. Created to automate tasks described in http://arifoctovian.wordpress.com/2012/08/18/installing-scala-in-os-x-mountain-lion/ since the Macport for scala-2.9 depends on the broken openjdk6 port
String version = '2.9.2'
String scalaDistributionURL = "http://www.scala-lang.org/downloads/distrib/files/scala-${version}.tgz"
String scalaDocDistributionURL = "http://www.scala-lang.org/downloads/distrib/files/scala-docs-${version}.zip"
String installDirName = '/opt/local/share/java'
final File installDir = new File(installDirName)
installDir.mkdir()
println "Installing scala version $version into ${installDir.absolutePath}"
//download if we already have not
@kellyrob99
kellyrob99 / OutputTransforms.groovy
Created September 22, 2012 20:01
GroovyConsole transforms file with the standard Map example and sortable JTable support for List/Set return values
import javax.swing.*
import javax.swing.table.*
transforms << { result ->
if (result instanceof Map) {
def table = new JTable(
result.collect { k, v ->
[k, v?.inspect()] as Object[]
} as Object[][],
['Key', 'Value'] as Object[])
@kellyrob99
kellyrob99 / markupBuilderTesting.groovy
Created June 17, 2012 21:08
Create iterm2 plist xml color preset files ready for import.
import groovy.xml.StreamingMarkupBuilder
import groovy.xml.XmlUtil
import java.awt.Color
/**
* Reads in a map of color themes, each with five hex color values, and maps them to an iterm color preset plist file.
*/
assert args.size() == 1, 'The name or path to a file containing a themeMap script variable must be supplied on the command line'
def themeMapFileName = args[0]
@kellyrob99
kellyrob99 / KulerThemeVisualization.groovy
Created June 17, 2012 20:19
Simple SwingBuilder application that reads in a file of mapped color themes and visualizes the results
import groovy.swing.*
import java.awt.*
import javax.swing.*
/**
* Reads in a map of color themes, each with five hex color values, and displays them in a Swing component.
*/
assert args.size() == 1, 'The name or path to a file containing a themeMap script variable must be supplied on the command line'
def themeMapFileName = args[0]
@kellyrob99
kellyrob99 / KulerScraper.groovy
Created June 17, 2012 19:34
Reads RSS feeds from Adobe kuler site and extracts the hexadecimal representation of each five element theme, writing those values to a file.
/**
* Reads RSS feeds from kuler and extracts the hexadecimal representation of each five element theme, writing those
* values to a file.
*/
def feeds = [
new URL("http://kuler-api.adobe.com/feeds/rss/get.cfm?itemsPerPage=100&listType=rating"),
new URL("http://kuler-api.adobe.com/feeds/rss/get.cfm?itemsPerPage=100&listType=popular")
]
def mappedThemes = [:]
def slurp = {rssXML, themes ->
@kellyrob99
kellyrob99 / ratExample.gradle
Created June 3, 2012 02:04
Gradle task definition for apache rat
configurations{
rat
}
dependencies {
rat 'org.apache.rat:apache-rat-tasks:0.8'
}
task rat(type: RatTask){
ratClasspath = configurations.rat
@kellyrob99
kellyrob99 / enable_log4j12-bz53299_build_with_Gradle_patch.patch
Created June 3, 2012 01:27
Patch file to enable building log4j12-bz53299 with Gradle. Still has some definite rough spots, including compile failures in both main and test and some failing tests(mostly due to classpath issues it seems)
Index: core/src/test/java/org/apache/log4j/util/JunitTestRunnerFilter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/src/test/java/org/apache/log4j/util/JunitTestRunnerFilter.java (revision 1345602)
+++ core/src/test/java/org/apache/log4j/util/JunitTestRunnerFilter.java (revision )
@@ -53,6 +53,13 @@
return null;
} else if(in.indexOf("JUnit4TestAdapter") >= 0) {
@kellyrob99
kellyrob99 / enable_log4j_build_with_Gradle.patch
Created June 2, 2012 20:55
Patch file to enable building log4j with Gradle
Index: ntdll.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- ntdll.gradle (revision )
+++ ntdll.gradle (revision )
@@ -0,0 +1,7 @@
+ant.'target.dir'='target'
+ant.'classes.dir'='target/classes'
@kellyrob99
kellyrob99 / githubWatcherDigraphGenerator.groovy
Created April 24, 2012 01:49
Read in a JSON file mapping Github users to those watching their repositories and output a GraphViz dot file representing the relationships. The file consumed is the output of the code found in https://gist.github.com/2468052
import groovy.json.JsonSlurper
final rootUser = args[0]
final filename = args[1]
def data
new File(filename).withReader {reader ->
data = new JsonSlurper().parse(reader)
}
println "Number of mapped users = ${data.size()}"