Skip to content

Instantly share code, notes, and snippets.

Avatar

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
agentgt / ColumnPrism.java
Created May 14, 2019
Example of Hickory generating a prism for JPA column
View ColumnPrism.java
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 net.java.dev.hickory.prism.internal.*;
import java.util.HashMap;
@agentgt
agentgt / LoggerService.java
Last active Mar 17, 2017
A wrapper SLF4j to avoid default static initialization
View LoggerService.java
package com.snaphop.slf4j;
import java.util.ServiceLoader;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.slf4j.helpers.NOPLoggerFactory;
public interface LoggerService {
View Example.java
/*
* EXAMPLE USAGE. NOT TESTED THOUGH.
*/
public class Example {
public static void example() {
//do a double lock synchronization block if you are setting a singleton
PomManifest pm = null;
try {
@agentgt
agentgt / CustomJooqGeneratorStrategy.java
Created Aug 31, 2016
A Jooq generator that puts POJO in a public package and records in a private package
View CustomJooqGeneratorStrategy.java
package com.snaphop.jooq;
import org.jooq.util.DefaultGeneratorStrategy;
import org.jooq.util.Definition;
public class CustomJooqGeneratorStrategy extends DefaultGeneratorStrategy {
@Override
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
agentgt / routine.rst
Last active Mar 17, 2017
Routine.rst
View routine.rst
@agentgt
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 http://stackoverflow.com/questions/6982159/eclipses-ctrl1-in-intellij-and-android-studio and live templates iter
@agentgt
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" />
<colors>
<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
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;