Skip to content

Instantly share code, notes, and snippets.

View jskorpan's full-sized avatar

Jonas Tärnström jskorpan

View GitHub Profile
@jskorpan
jskorpan / timewasted.html
Created February 23, 2012 21:35
Time wasted this day and this year in percent
<html>
<head>
<title>How much of this year and this day have you wasted in percent down to 10 painful decimals</title>
</head>
<body>
<div style="height:auto;">
<div align="center" id="headingyear" style="font-size:25px"></div>
<div align="center" id="timeleftyear" style="font-family:Monospace;font-size:30px"></div>
<br>
@jskorpan
jskorpan / SortListTimer.java
Created July 8, 2011 07:41
A ConcurrentSkipListSet based Timer compatible with Netty's HashedWheelTimer
import org.jboss.netty.util.ThreadRenamingRunnable;
import org.jboss.netty.util.Timeout;
import org.jboss.netty.util.Timer;
import org.jboss.netty.util.TimerTask;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.ConcurrentSkipListSet;
@jskorpan
jskorpan / StringTokenizer.java
Created June 30, 2011 11:37 — forked from cgbystrom/StringTokenizer.java
Ultra fast Java string tokenizer
public class StringTokenizer {
private static ThreadLocal<String[]> tempArray = new ThreadLocal<String[]>();
public static String[] tokenize(String string, char delimiter)
{
String[] temp = tempArray.get();
int tempLength = (string.length() / 2) + 2;
if (temp == null || temp.length < tempLength)
{