Skip to content

Instantly share code, notes, and snippets.


Don McCurdy donmccurdy

View GitHub Profile
donmccurdy /
Last active Apr 16, 2021
A minimal set of tools for creating a JavaScript or TypeScript library.

These are the build tools I prefer to use when starting a new JavaScript or TypeScript library. Most libraries I write run both in the browser and in node.js. Each project needs to be lightweight, and to minimize maintenance. And I need build chains for those libraries to pretty much "just work". That last part has become more important over time, as I've maintained more libraries and generally had less time to deal with dependencies and build system issues. For web applications, as opposed to libraries consumed in other projects, these choices may or may not make sense. These are opinionated choices, and will probably change over time.

Almost always:

  • microbundle: Zero-config Rollup bundler, with optional TypeScript support
  • tape: Test runner
  • tap-spec: Clean test output


donmccurdy /
Last active Jun 18, 2020
Color management in three.js
donmccurdy /
Last active Jun 7, 2021
Convert legacy three.js (JSON) files to glTF 2.0


Converts legacy JSON models (created by the three.js Blender exporter, for THREE.JSONLoader) to glTF 2.0. When original .blend files are available, prefer direct export from Blender 2.80+.

NOTE: JSON files created with .toJSON() use a newer JSON format, which isn't deprecated, and these are still supported by THREE.ObjectLoader. This converter does not support that newer type of JSON file.


npm install canvas vblob three
donmccurdy / convert_vector_tiles_to_geojson.js
Created Aug 16, 2019
Convert a directory of vector tiles to GeoJSON.
View convert_vector_tiles_to_geojson.js
const fs = require('fs');
const vt2geojson = require('@mapbox/vt2geojson');
const glob = require('glob');
glob('tiles/**/*.pbf', {}, function (er, files) {
files.forEach((path) => {
const [_, z, x, y] = path.match(/^tiles\/(\d+)\/(\d+)\/(\d+)\.pbf/);
console.log(`x: ${x}`);
donmccurdy / Pool.js
Created Jul 21, 2019
Simple pool implementation.
View Pool.js
* Simple pool of generic objects.
* @param {function():T} Function that creates a resource.
* @param {function():T} Function that resets a resource.
function Pool ( factory, reset ) {
this.factory = factory;
this.reset = reset;
this.resources = [];
donmccurdy / index.html
Last active Jun 18, 2019 — forked from Pessimistress/index.html GoogleMapOverlay fullscreen bug
View index.html
<script src="^7.0.0/dist.min.js"></script>
<script src=""></script>
<style type="text/css">
body {margin: 0; padding: 0; overflow: hidden;}
#container {width: 100vw; height: 75vh;}
#tooltip {position: absolute; z-index: 1; background: #000; color: #fff; font-family: sans-serif; font-size: 11px; padding: 4px; padding: 8px; pointer-events: none;}
View fromages_pruned.glb
This file has been truncated, but you can view the full file.
donmccurdy / algorithms.json
Last active Apr 2, 2019
Generate JSDoc from Earth Engine algorithm descriptors.
View algorithms.json
"data": {
"Filter.greaterThanOrEquals": {
"args": [
"default": null,
"description": "A selector for the left operand. Should not be specified if leftValue is specified.",
"name": "leftField",
"optional": true,
"type": "String"
donmccurdy / DRACOLoader.patch
Last active Dec 21, 2020
THREE.GLTFLoader with Draco support in Node.js.
View DRACOLoader.patch
diff --git a/node_modules/three/examples/js/loaders/DRACOLoader.js b/NodeDRACOLoader.js
index 57767d7..cc46f2c 100644
--- a/node_modules/three/examples/js/loaders/DRACOLoader.js
+++ b/NodeDRACOLoader.js
@@ -14,10 +14,12 @@
'use strict';
+const decoder = require('draco3dgltf').createDecoderModule();