Skip to content

Instantly share code, notes, and snippets.

View amuraco's full-sized avatar

Andrew Muraco amuraco

  • Magnite
  • Buffalo, NY
View GitHub Profile
@amuraco
amuraco / AbstractWrappedJDBC41Connection.java
Created December 3, 2012 16:34
AbstractWrappedJDBC41Connection: JDBC 4.1 Compatibility with JDK 6+
package amuraco;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.concurrent.Executor;
public abstract class AbstractWrappedJDBC41Connection implements Connection {
@amuraco
amuraco / PuddleCounter.java
Created October 31, 2013 03:52
Single iteration streaming java solution for http://qandwhat.apps.runkite.com/i-failed-a-twitter-interview/ This solution is ideal if myIntArray could be very large (i.e. > 1m ints) but with a limited range (i.e. 0-10) I would probably use a stack based solution if the range could be highly variable (0-10m) with the number of ints being relative…
package test;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class PuddleCounter {
public long calculateVolume(int[] myIntArray) {
long total = 0;
int pendingTotals[] = new int[0];