Skip to content

Instantly share code, notes, and snippets.

View greggigon's full-sized avatar
🎧
Focusing

Greg greggigon

🎧
Focusing
View GitHub Profile
### Keybase proof
I hereby claim:
* I am greggigon on github.
* I am greggigon (https://keybase.io/greggigon) on keybase.
* I have a public key ASDtjJuwVD6l31r9qFw2_FQGrH57QRLaZ9s73MNumFB8RAo
To claim this, I am signing this object:
@greggigon
greggigon / JsonMap.groovy
Last active September 27, 2016 12:34
I always find myself using a lot of HashMaps in Groovy where in Java I would create a Pojo or something. This little gist turns the map into a somehow formatted JSON. The code assumes that maps are keyed by Strings, can contain other Maps, Lists or Objects. If the map value is an object .toString() will be used to get it's value. Proved useful w…
class JsonMap {
def toJSON(elements, depth = 0) {
def json = ""
depth.times { json += "\t" }
json += "{"
elements.each { key, value ->
json += "\"$key\":"
json += jsonValue(value, depth)
json += ", "
}
@greggigon
greggigon / gist:5949894
Created July 8, 2013 15:35
Example gradle build file for the Grails NON distribution plugin
buildscript {
repositories {
mavenCentral()
maven { url 'http://repo.grails.org/grails/repo/' }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.0.0-SNAPSHOT"
}
@greggigon
greggigon / RepositorySize.groovy
Created June 19, 2013 09:41
This simple Artifactory plugin does a job of Calculating repository size by recursively iterating over Repository items and adding sizes of the artifacts.
import org.artifactory.repo.RepoPathFactory
def getDirectorySizeRecursively(def repoPath){
def children = repositories.getChildren(repoPath)
if (children.size() == 0) return 0
def total = 0
children.each { item ->
if (item.folder) {
total += getDirectorySizeRecursively(item.repoPath)
@greggigon
greggigon / python.2.7.7.spec
Created July 3, 2014 09:41
RPM Spec for building Python 2.7.7 on RedHat 6.4
Name: python2.7
Version: 2.7.7
Release: 1%{?dist}
Summary: Python version 2.7.7 installation
Group: Development/Tools
License: GPL
URL: http://python.org
Source0: Python-2.7.7.tgz