Skip to content

Instantly share code, notes, and snippets.

View donmccurdy's full-sized avatar

Don McCurdy donmccurdy

View GitHub Profile
@donmccurdy
donmccurdy / JAVASCRIPT_LIBRARY_TOOLS.md
Last active April 16, 2021 05:36
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

Occasionally:

@donmccurdy
donmccurdy / THREE_COLORSPACE_MANAGEMENT.md
Last active January 2, 2023 08:07
Color management in three.js
@donmccurdy
donmccurdy / README.md
Last active September 25, 2024 15:50
Convert legacy three.js (JSON) files to glTF 2.0

legacythree2gltf.js

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.

Installation:

npm install canvas vblob three
@donmccurdy
donmccurdy / convert_vector_tiles_to_geojson.js
Created August 16, 2019 22:35
Convert a directory of vector tiles to GeoJSON.
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}`);
vt2geojson({
@donmccurdy
donmccurdy / Pool.js
Created July 21, 2019 05:29
Simple pool implementation.
/**
* 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
donmccurdy / index.html
Last active June 18, 2019 22:57 — forked from Pessimistress/index.html
deck.gl GoogleMapOverlay fullscreen bug
<html>
<head>
<script src="https://unpkg.com/deck.gl@^7.0.0/dist.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDaoLdV31Y5ls8ABBpuAQt9t8RzMDfOMiM&libraries=visualization&v=3.34"></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;}
</style>
@donmccurdy
donmccurdy / fromages_pruned.glb
Last active April 30, 2019 08:01
Cheeseboard.glb
This file has been truncated, but you can view the full file.
@donmccurdy
donmccurdy / algorithms.json
Last active April 2, 2019 18:35
Generate JSDoc from Earth Engine algorithm descriptors.
{
"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
donmccurdy / DRACOLoader.patch
Last active March 12, 2025 06:10
THREE.GLTFLoader with Draco support in Node.js.
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();
+
@donmccurdy
donmccurdy / DASHLANE_FEEDBACK.md
Last active May 23, 2020 00:34
Convert Dashlane JSON export to 1Password CSV import.

I've been a Dashlane user since July 2016, and am finally moving to 1Password because of problems with the macOS app and browser extensions, several of which I've reported repeatedly since 2016. In order of severity:

(1) Do not prompt users to install the browser extensions indefinitely. I'm unwilling and unable to install the extensions on certain browsers at work, because of both work policy and personal security preference. For the past two years, the Dashlane app has prompted me aggressively – opening a prompt, opening a browser tab when I try to close that prompt, and then prompting AGAIN when I try to close that browser tab. Dashlane needs to provide a way to opt out of this, for users with legitimate reasons to not want a browser extension to have access to each website they visit, or who use multiple browsers for e.g. work purposes.

(2) The macOS app regularly locks up on my Macbook Pro, and may require a forced restart and several minutes to load and authenticate.

(3) CSV exports, when I tried to