Skip to content

Instantly share code, notes, and snippets.

@josefbetancourt
josefbetancourt / SvnOutputTransform.java
Last active Dec 15, 2015
Transform SVN log diff using Java XPath example for blog post http://octodecillion.com/blog/svn-report-java-xpath/
View SvnOutputTransform.java
/**
*
*/
package com.octodecillion.utils;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Reader;
@josefbetancourt
josefbetancourt / GraphSort.java
Last active Dec 10, 2015
Source code for blog post "List sorting using topological ordering of a digraph" http://octodecillion.com/blog/sort-using-digraph/
View GraphSort.java
package com.octodecillion.sort;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
@josefbetancourt
josefbetancourt / Vsdf.groovy
Last active Dec 9, 2015
Groovy source code from blog post "A very simple data file metaformat" at http://octodecillion.com/blog/very-simple-data-file-format/
View Vsdf.groovy
package com.octodecillion.inix
import java.util.regex.Pattern
import groovy.transform.TypeChecked
import java.util.regex.Matcher
/**
*
*
* @author Josef Betancourt
View DuplicatePropertyDetectorWithSubClass.java
package com.octodecillion.util;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
View DuplicatePropertyDetectorWithJavassist.java
package com.octodecillion.util;
import java.io.IOException;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
View DuplicatePropertyDetectorWithCGLIB.java
package com.octodecillion.util;
import java.io.IOException;
import java.io.Reader;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
View InitMap.java
package com.octodecillion.util;
import java.util.Map;
import java.util.Map.Entry;
/**
* A {@link Map} decorator that allows
* <a href="https://en.wikipedia.org/wiki/Fluent_interface#Java">Fluent</a>
* add of entries.<p>
*
@josefbetancourt
josefbetancourt / JarInfo.java
Created Dec 15, 2012
Source code from blog post "Java Generics Example: Jar Manifest" at [http://octodecillion.com/blog/java-generics-manifest/]
View JarInfo.java
/**
*
*/
package com.octodecillion.utils;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
@josefbetancourt
josefbetancourt / InvokeCounter.java
Last active Oct 13, 2015
Behavior counters for improved JUnit tests
View InvokeCounter.java
package com.octodecillion.junit;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
/**
@josefbetancourt
josefbetancourt / Vsdf.java
Last active Oct 13, 2015
Very simple data file in Java source with embedded JUnit test. Presented in "Simple Java Data File" blog post.
View Vsdf.java
/** Vsdf.java */
package com.octodecillion.vsdf;
import static com.octodecillion.vsdf.Vsdf.EventType.END;
import static org.hamcrest.core.DescribedAs.describedAs;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;