Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Schaub tschaub

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

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 http://labs.strava.com/gpx-to-route/
* 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, latLng.lat];
});
@tschaub
tschaub / index.html
Last active Mar 28, 2017
Test polyfill.io Promise in a Worker
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test Promise.resolve() in a Worker</title>
</head>
<body>
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
tschaub / .gitignore
Last active Sep 25, 2019
OpenLayers + Webpack
View .gitignore
/node_modules/
bundle.js
@tschaub
tschaub / .gitignore
Last active Apr 25, 2019
OpenLayers + Rollup
View .gitignore
/node_modules/
bundle.js
@tschaub
tschaub / _.md
Last active Aug 17, 2019
TopoJSON Time Zones
View _.md

TopoJSON Time Zones

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

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

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
tschaub / AngularStyle.md
Last active Dec 20, 2016
Opinionated whitespace guide for AngularJS modules
View AngularStyle.md

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 gjslint.py.

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('module.name', [
You can’t perform that action at this time.