Skip to content

Instantly share code, notes, and snippets.

🛌
Stay Home

Don McCurdy donmccurdy

🛌
Stay Home
View GitHub Profile
View TMP.md

link

device os browser status
iphone se iOS safari 🚫
iphone 11 iOS safari 🚫
nexus 5x android chrome
nexus 5x android firefox
pixel 4 android chrome
pixel 4 android firefox
@donmccurdy
donmccurdy / JAVASCRIPT_LIBRARY_TOOLS.md
Last active Jun 11, 2020
A minimal set of tools for creating a JavaScript or TypeScript library.
View JAVASCRIPT_LIBRARY_TOOLS.md

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 Jun 18, 2020
Color management in three.js
View THREE_COLORSPACE_MANAGEMENT.md
@donmccurdy
donmccurdy / README.md
Last active Jun 8, 2020
Convert legacy three.js (JSON) files to glTF 2.0
View README.md

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 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}`);
vt2geojson({
@donmccurdy
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
donmccurdy / index.html
Last active Jun 18, 2019 — forked from Pessimistress/index.html
deck.gl GoogleMapOverlay fullscreen bug
View index.html
<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>
View fromages_pruned.glb
This file has been truncated, but you can view the full file.
@donmccurdy
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
donmccurdy / DRACOLoader.patch
Last active Jul 2, 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();
+
You can’t perform that action at this time.