Skip to content

Instantly share code, notes, and snippets.


Piotr Wittchen pwittchen

View GitHub Profile

This example is the second of three in the Path Transitions tutorial; see the previous example for context.

The desired pairing of numbers for path interpolation is like this:

M x0, y0 L x1, y1 L x2, y2 L x3, y3 L xR, y4
   ↓   ↓    ↓   ↓    ↓   ↓    ↓   ↓
M xl, y0 L x0, y1 L x1, y2 L x2, y3 L x3, y4

Where xl is some negative value off the left side, and xr is some positive value off the right side. This way, the first point ⟨x0,y0⟩ is interpolated to ⟨xl,y0⟩; meaning, the x-coordinate is interpolated rather than the y-coordinate, and so the path appears to slide off to the left. Likewise, the incoming point ⟨xr,y4⟩ is interpolated to ⟨x3,y4⟩.

import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.functions.Action0;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
package jmodern;
import com.codahale.metrics.*;
import com.codahale.metrics.annotation.*;
import com.fasterxml.jackson.annotation.*;
import feign.Feign;
import feign.jackson.*;
import feign.jaxrs.*;
import io.dropwizard.Application;
pwittchen / gist:28c2e6fe4f874bec2f84
Created Dec 8, 2015 — forked from deepak/gist:5933685
Set ENV in Dockerfile with string interpolation
View gist:28c2e6fe4f874bec2f84
FROM ubuntu:12.04
# install essentials
RUN apt-get install -y -q git
# Install rbenv
RUN git clone /usr/local/rbenv
RUN echo '# rbenv setup' > /etc/profile.d/
pwittchen /
Created Dec 20, 2015 — forked from derhuerst/
List of HAFAS API Endpoints
pwittchen /
Created Dec 28, 2015 — forked from datagrok/
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

pwittchen / base64.js
Created Dec 29, 2015 — forked from whatnickcodes/base64.js
How to Encode and Decode Strings with Base64 in JavaScript
View base64.js
// Create Base64 Object
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r
pwittchen /
Created Jan 9, 2016 — forked from candidtim/
Ubuntu AppIndicator to show Chuck Norris jokes
# This code is an example for a tutorial on Ubuntu Unity/Gnome AppIndicators:
import os
import signal
import json
from urllib2 import Request, urlopen, URLError
from gi.repository import Gtk as gtk
pwittchen /
Created Jan 13, 2016 — forked from davepkennedy/
public class App
private static final String JDBC_DRIVER = "org.sqlite.JDBC";
private static final String CONNECTION_STRING = "jdbc:sqlite:/tmp/testdb.db";
public static void main( String[] args ) throws SQLException, ClassNotFoundException {
SQLiteDataSource ds = new SQLiteDataSource();
DBI dbi = new DBI(ds);
Handle h =;