Skip to content

Instantly share code, notes, and snippets.

@emoseman
emoseman / search_perf.java
Created October 25, 2013 20:29
Some tests for array search performance.
package com.aol.data.api.query;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
import org.apache.commons.lang3.time.StopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.security.SecureRandom;
@emoseman
emoseman / pom.xml
Created May 13, 2013 15:34
Maven: Packaging dependencies alongside project JAR.
Configure the Maven Jar Plugin to do so (or more precisely, the Maven Archiver):
<project>
...
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
@emoseman
emoseman / logback.xml
Created May 3, 2013 15:34
Initialial logback.xml
<!-- most of this copied directly from http://logback.qos.ch/manual/configuration.html -->
<configuration debug = "false" scan = "false" scanPeriod = "30 seconds">
<contextName>AppName</contextName>
<appender name = "STDOUT" class = "ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
@emoseman
emoseman / pom.xml
Last active December 16, 2015 02:39
Initial generic project startup pom.xml file.
<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>org.group</groupId>
<artifactId>artifact-name</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
@emoseman
emoseman / intellij.desktop
Last active December 10, 2015 16:38
Ubuntu Unity Launcher desktop file for IntelliJ
[Desktop Entry]
Version=1.0
Name=IntelliJ-12.0.1
Comment=IDEA IntelliJ 12.0.1
Exec=/home/emoseman/idea-IC-123.94/bin/idea.sh
Icon=/home/emoseman/idea-IC-123.94/bin/idea.png
Terminal=false
Type=Application
Categories=Development;Java;IDE;
@emoseman
emoseman / AResource.java
Created August 27, 2012 18:32
Sample Java Jersey REST Resource
package your.org.here;
/**
* Class Description todo
*
* @author Your Name ([email protected])
* @since 7/16/12
* @version 1.0
*/
import javax.naming.NamingException;
@emoseman
emoseman / build.gradle
Created August 27, 2012 18:23
Gradle build file for Java Jersey 1.12
apply plugin: 'java'
apply plugin: 'war'
version = "1.0"
group = "your.org.here"
task explodedWar(type: Copy) {
into "$buildDir/exploded"
with war
}
@emoseman
emoseman / plpgsql-create-type.sql
Created August 27, 2012 14:23
postgresql create type
DROP TYPE NAME CASCADE;
CREATE TYPE NAME (
INT,TEXT
);
@emoseman
emoseman / plpgsql-create-function.sql
Created August 27, 2012 14:21
postgresql create function
-- DROP FUNCTION IF EXISTS function name;
CREATE FUNCTION function name (
argument types
)
RETURNS return type
AS $$
DECLARE
function scope variables
BEGIN
@emoseman
emoseman / common.gradle
Created June 6, 2012 15:22
Common gradle build
/*
* Common build file for gradle builds.
* To include use:
* apply from: "https://raw.github.com/gist/2882571/2a96a6218b24acbb1e47e87bedab180e2a3ac3ca/common.gradle"
*/
List apachecommons = ["commons-beanutils:commons-beanutils:1.8.3",
"org.apache.commons:commons-lang3:3.1",
"commons-logging:commons-logging:1.1.1"]