Skip to content

Instantly share code, notes, and snippets.

View stevenschlansker's full-sized avatar

Steven Schlansker stevenschlansker

  • Wholesail
  • San Francisco, CA
View GitHub Profile
public class ElLikeSubstitutionUtils {
private static final Pattern MATCH_PATTERN = Pattern.compile("\\$\\{([^}]+)\\}");
/**
* Replace ${name} with the appropriate template value retrieved from the map.
* Does not gracefully handle nested or mismatched brace patterns
*/
public static Verified<String> substitute(String string, Map<String, String> parameters) {
List<SyndicationVerificationError> errors = Lists.newArrayList();
2015-10-05T17:36:34.160Z WARN <> [qtp671959170-3326] org.eclipse.jetty.server.HttpChannel - //mesos-slave2-qa-sf.qasql.opentable.com:31564/announcement
org.jboss.resteasy.spi.UnhandledException: RESTEASY003770: Response is committed, can't handle exception
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:164) ~[discovery-server-0.11.3-jar-with-dependencies.jar:0.11.3]
at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:452) ~[discovery-server-0.11.3-jar-with-dependencies.jar:0.11.3]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:396) ~[discovery-server-0.11.3-jar-with-dependencies.jar:0.11.3]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:199) ~[discovery-server-0.11.3-jar-with-dependencies.jar:0.11.3]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221) ~[discovery-server-0.11.3-jar-with-dependen
2015-10-05T17:36:44.289Z INFO <> [Server Shutdown Thread] o.e.j.server.handler.ContextHandler - Stopped o.e.j.s.ServletContextHandler@6993c8df{/,null,UNAVAILABLE}
2015-10-05T17:36:59.300Z WARN <> [qtp671959170-3241] o.e.j.util.SharedBlockingCallback - Blocker not complete Blocker@44027995{null}
2015-10-05T17:36:59.301Z WARN <> [qtp671959170-1624] o.e.j.util.thread.QueuedThreadPool - qtp671959170{STOPPING,10<=40<=40,i=0,q=41621} rejected org.eclipse.jetty.io.ManagedSelector$2@18d3108
2015-10-05T17:36:59.302Z WARN <> [qtp671959170-1624] o.e.j.util.thread.QueuedThreadPool -
java.util.concurrent.RejectedExecutionException: org.eclipse.jetty.io.ManagedSelector$2@18d3108
at org.eclipse.jetty.util.thread.QueuedThreadPool.execute(QueuedThreadPool.java:377) ~[discovery-server-0.11.3-jar-with-dependencies.jar:0.11.3]
at org.eclipse.jetty.util.thread.strategy.ProduceExecuteConsume.execute(ProduceExecuteConsume.java:58) ~[discovery-server-0.11.3-jar-with-dependencies.jar:0.11.3]
at org.eclipse.jetty.util.thread.strategy.
create temporary table foo (key integer primary key, value integer);
insert into foo values (1,1);
insert into foo values (1,2);
insert into foo values (3,10);
WITH ids AS ( SELECT 1 AS id ) SELECT * FROM foo, ids WHERE key = ids.id OR value = ids.id;
key | value | id
-----+-------+----
1 | 1 | 1
bind (MyCoolObject.class).annotatedWith(bindingAnnotation);
bind (MyDependentObject.class).annotatedWith(bindingAnnotation).toProvider(new MyDependentProvider(bindingAnnotation));
class MyDependentProvider implements Provider<MyDependentObject>
{
MyDependentProvider(Annotation bindingAnnotation) { ... }
@Inject
public void setInjector(Injector injector) { ... }
package com.nesscomputing.uuid;
import java.util.UUID;
import com.google.caliper.Runner;
import com.google.caliper.SimpleBenchmark;
public class PerformanceComparison extends SimpleBenchmark
{
@stevenschlansker
stevenschlansker / gist:6153643
Created August 5, 2013 05:09
Java String intern() speedup
diff -r 2bfa00fac03f src/share/vm/classfile/javaClasses.cpp
--- a/src/share/vm/classfile/javaClasses.cpp Thu Jul 04 01:00:19 2013 -0700
+++ b/src/share/vm/classfile/javaClasses.cpp Sun Aug 04 22:08:03 2013 -0700
@@ -322,9 +322,7 @@
jchar* result = NEW_RESOURCE_ARRAY_RETURN_NULL(jchar, length);
if (result != NULL) {
- for (int index = 0; index < length; index++) {
- result[index] = value->char_at(index + offset);
- }
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.Random;
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
import org.openjdk.jmh.annotations.State;
import io.airlift.slice.Slice;
sqlite> CREATE VIRTUAL TABLE tokens1 USING fts3tokenize(simple,en_US);
sqlite> SELECT * FROM tokens1 WHERE input='song_0';
input|token|start|end|position
song_0|song|0|4|0
song_0|0|5|6|1
public class ForgettingExecutor
{
private ForgettingExecutor() { }
public static <T> Future<T> submit(ExecutorService executor, Callable<T> callable)
{
return executor.submit(new ForgettingCallable<>(new AtomicReference<>(callable)));
}
private static class ForgettingCallable<T> implements Callable<T>