Skip to content

Instantly share code, notes, and snippets.

@johnrengelman
johnrengelman / pom.xml
Created February 7, 2014 00:13
Maven 3 POM type dependency
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
@johnrengelman
johnrengelman / build.gradle
Created January 10, 2014 19:50
Shadow 0.8 BuildScript
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:0.8'
}
}
var gistPrefix = 'https://gist.github.com/',
// Cache document.write so that it can be restored once all Gists have been
// embedded.
cachedWrite = document.write,
body = $('body'),
// Map each p.gist to an object that contains the paragraph to be replaced
// and the Gist's identifier.
gists = $('a.gist').map(function(n, a) {
a = $(a);
var href = a.attr('href');
@johnrengelman
johnrengelman / EchoApp.class
Last active December 31, 2015 22:39
Reproducible Gradle
package john.app;
import groovy.lang.Closure;
import groovy.lang.GroovyObject;
import groovy.lang.MetaClass;
import john.lib.EchoUtil;
import org.codehaus.groovy.runtime.GeneratedClosure;
import org.codehaus.groovy.runtime.callsite.CallSite;
public class EchoApp
@johnrengelman
johnrengelman / .zshrc
Created December 13, 2013 15:42
ZSH profile
source ~/.aliases/main
source "$HOME/.antigen/antigen.zsh"
export SHELL=/bin/zsh
antigen use oh-my-zsh
#antigen bundle git
antigen bundle gitfast
antigen bundle gradle
antigen bundle grails
antigen bundle redis-cli
@johnrengelman
johnrengelman / EmbeddedPipeline.groovy
Created November 20, 2013 17:20
Implementation of Pipeline for EmbeddedRedis
import com.lordofthejars.nosqlunit.redis.embedded.EmbeddedJedis
import redis.clients.jedis.BinaryClient
import redis.clients.jedis.Builder
import redis.clients.jedis.BuilderFactory
import redis.clients.jedis.Pipeline
import redis.clients.jedis.Response
import redis.clients.jedis.SortingParams
import redis.clients.jedis.Tuple
import redis.clients.jedis.ZParams
import redis.clients.jedis.exceptions.JedisDataException
@johnrengelman
johnrengelman / EchoService.groovy
Last active December 27, 2015 19:19
Dropwizard Guice
class EchoService extends Service<EchoConfiguration> {
public static void main(String[] args) {
new EchoService().run(args)
}
@Override
void initialize(Bootstrap<EchoConfiguration> bootstrap) {
bootstrap.addBundle(
GuiceBundle.<EchoConfiguration>newBuilder()
@johnrengelman
johnrengelman / H2MysqlSupportDialect.groovy
Created October 29, 2013 18:30
Custom H2 Hibernate Dialect to support differences in MySQL and H2 query syntax
import org.hibernate.dialect.H2Dialect
import org.hibernate.dialect.function.SQLFunctionTemplate
import org.hibernate.type.StandardBasicTypes
class H2MysqlSupportDialect extends H2Dialect {
H2MysqlSupportDialect() {
registerFunction('datediff', new SQLFunctionTemplate(StandardBasicTypes.DATE, "datediff('DAY', ?2, ?1)"))
}
}
`require': no such file to load -- io/console (LoadError)
from /Users/jengelman/scripts/selecta:16:in `<main>'
@johnrengelman
johnrengelman / build.gradle
Created October 9, 2013 21:54
Deploying custom artifact with POM dependencies using Gradle 'maven-publish'
File pluginZip = project.file("grails-${project.name}-${version}.zip")
assemble.outputs.file pluginZip
project.components.add(new JavaLibrary(
new org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact(
project.name,
'zip',
'zip',
'',
new Date(pluginZip.lastModified()),