Skip to content

Instantly share code, notes, and snippets.


Tim Schaub tschaub

View GitHub Profile
tschaub /
Last active Jun 11, 2020
Reproducible module builds with tools (commands) as dependencies

Tools as dependencies

This example is a slight tweak on the best-practices example for working with Go modules as development dependencies.

The downside of the existing example is that someone who git clones your module to make a contribution, would not be able to run go generate (without extra work).

$ go generate
painkiller.go:5: running "stringer": exec: "stringer": executable file not found in $PATH
View strava-to-kml.js
* 1. Go to
* 2. Enter a Strava activity URL
* 3. Run this snippet
map.eachLayer(layer => {
if (layer.getLatLngs) {
const coordinates = layer.getLatLngs().map(latLng => {
return [latLng.lng,];
tschaub / index.html
Last active Mar 28, 2017
Test Promise in a Worker
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test Promise.resolve() in a Worker</title>
This is a simple smoke test for <code>Promise.resolve()</code> in a Worker.
You should see an alert telling you if things worked or not.
<script src="./main.js"></script>
tschaub / .gitignore
Last active Sep 25, 2019
OpenLayers + Webpack
View .gitignore
tschaub / .gitignore
Last active Apr 25, 2019
OpenLayers + Rollup
View .gitignore
tschaub /
Last active Aug 17, 2019
TopoJSON Time Zones

TopoJSON Time Zones

The result is this 181 KB timezones.json (36 KB with gzip)

tschaub /
Created Mar 3, 2016
Delete all branches that are already merged into the current branch
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
set -o errexit
# This script gives you git bash completion and a minimal
# prompt displaying the branch name.
if [ -f "$HOME/.bashrc" ]; then
elif [ -f "$HOME/.bash_profile" ]; then
tschaub /
Last active Aug 29, 2015
Build GeoServer with scripting support

Build GeoTools:

cd ~/projects/geotools
mvn clean install -DskipTests -T 4C

(Skip the -T 4C for Maven 2.)

Build GeoServer and prep Eclipse project:

cd ~/projects/geoserver/src
tschaub /
Last active Dec 20, 2016
Opinionated whitespace guide for AngularJS modules

AngularJS Whitespace Guide

The purpose of this style guide is to suggest formatting conventions for AngularJS modules that result in readible, maintainable, and lint free code (see the linter configurations for JSHint and

All-in-one example

Typically, an AngularJS application would be structured with many modules in separate files. The example below shows a monolithic module to illustrate the formatting conventions for various module methods.

angular.module('', [
You can’t perform that action at this time.