Skip to content

Instantly share code, notes, and snippets.

@tschaub
tschaub / tools-as-depdendencies.md
Last active June 11, 2020 03:03
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
/**
* 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 March 28, 2017 00:12
Test polyfill.io Promise in a Worker
<!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 January 20, 2023 14:23
OpenLayers + Webpack
/node_modules/
bundle.js
@tschaub
tschaub / .gitignore
Last active April 25, 2019 22:34
OpenLayers + Rollup
/node_modules/
bundle.js
@tschaub
tschaub / _.md
Last active November 29, 2023 02:06
TopoJSON Time Zones

TopoJSON Time Zones

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

@tschaub
tschaub / git-tidy-alias.sh
Last active August 24, 2021 19:02
Prune all remotes and delete all branches that are already merged into the current branch
git config --global alias.tidy '!for r in `git remote`; do git remote prune $r; done && git branch --merged | grep -v "\*" | xargs -n 1 git branch -d'
#!/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 August 29, 2015 13:56
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
tschaub / AngularStyle.md
Last active December 20, 2016 15:28
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 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', [