Skip to content

Instantly share code, notes, and snippets.


Adam Gent agentgt

View GitHub Profile
View gist:97db11fadafed1579564b630138fc769
hg init
echo Upstream1 > main.txt
hg add main.txt
hg commit -m "Master1"
hg branch -q feature
agentgt /
Created May 14, 2019
Example of Hickory generating a prism for JPA column
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.VariableElement;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.type.TypeMirror;
import java.util.HashMap;
agentgt /
Last active Mar 17, 2017
A wrapper SLF4j to avoid default static initialization
package com.snaphop.slf4j;
import java.util.ServiceLoader;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.slf4j.helpers.NOPLoggerFactory;
public interface LoggerService {
public class Example {
public static void example() {
//do a double lock synchronization block if you are setting a singleton
PomManifest pm = null;
try {
agentgt /
Created Aug 31, 2016
A Jooq generator that puts POJO in a public package and records in a private package
package com.snaphop.jooq;
import org.jooq.util.DefaultGeneratorStrategy;
import org.jooq.util.Definition;
public class CustomJooqGeneratorStrategy extends DefaultGeneratorStrategy {
public String getJavaClassName(Definition definition, Mode mode) {
View mvn-bom.groovy
#!/usr/bin/env groovy
import groovy.xml.MarkupBuilder
def xml = new XmlSlurper().parse(new File(args[0]));
def sw = new StringWriter()
def b = new MarkupBuilder(sw)
def i = 0;
b.dependencyManagement() {
dependencies() {
agentgt / routine.rst
Last active Mar 17, 2017
View routine.rst
agentgt / EclipseToIntellij.txt
Last active Mar 4, 2016
Eclipse to IntelliJ
View EclipseToIntellij.txt
Action | Eclipse | Intellij
Mini Outline | Command-o | Command-F12
Call Hiearchy | Ctrl-Alt-h | Ctrl-Alt-h
Find references | Shift-Command-G | Alt-F7
Quick Access | Command-3 | Command-Shift-a
Hint solver | ctrl-1 | see and live templates iter
agentgt / One Dark.icls
Last active Jan 8, 2019
Intellij Atom One Dark theme
View One Dark.icls
<scheme name="One Dark" version="142" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="12" />
<option name="CONSOLE_FONT_NAME" value="Monospaced" />
<option name="EDITOR_FONT_NAME" value="Menlo" />
<option name="ADDED_LINES_COLOR" value="abb2bf" />
<option name="ANNOTATIONS_COLOR" value="ffffff" />
<option name="ANNOTATIONS_MERGED_COLOR" value="ffffff" />
<option name="CARET_COLOR" value="61afef" />
agentgt / Mustache.groovy
Created Jan 28, 2016
A Groovy mustache(1) replacement
View Mustache.groovy
#!/usr/bin/env groovy
@Grab(group='com.github.jknack', module='handlebars', version='4.0.3')
@Grab(group='org.yaml', module='snakeyaml', version='1.16')
@Grab(group='org.slf4j', module='slf4j-simple', version='1.7.14')
import org.yaml.snakeyaml.Yaml;
import com.github.jknack.handlebars.Handlebars;
import com.github.jknack.handlebars.Template;