Skip to content

Instantly share code, notes, and snippets.

Don McCurdy donmccurdy

Block or report user

Report or block donmccurdy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 Jun 22, 2019
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();
+
@donmccurdy
donmccurdy / DASHLANE_FEEDBACK.md
Last active Mar 1, 2019
Convert Dashlane JSON export to 1Password CSV import.
View DASHLANE_FEEDBACK.md

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

View googlemaps_and_deckgl.js
const {Deck} = require('@deck.gl/core');
const {GeoJsonLayer} = require('@deck.gl/layers');
// Outlines of US States. Source: Natural Earth http://www.naturalearthdata.com/ via geojson.xyz
const US_MAP_GEOJSON =
'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_admin_1_states_provinces_shp.geojson';
const TILE_SIZE = 256;
const INITIAL_VIEW_STATE = {
@donmccurdy
donmccurdy / csv-processing.js
Created Oct 31, 2018
example CSV transformation in Node.js
View csv-processing.js
const fs = require('fs')
const csv = require('csv');
fs.createReadStream('data.csv')
.pipe(csv.parse({columns: true}))
.pipe(csv.transform((input) => {
return Object.assign({}, input, {
foo: input['foo'].toUpperCase()
});
}))
@donmccurdy
donmccurdy / FOO2GLTF.js
Last active Sep 6, 2019
Example Node.js glTF conversion script, using three.js.
View FOO2GLTF.js
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const THREE = require('three');
const program = require('commander');
const Canvas = require('canvas');
const { Blob, FileReader } = require('vblob');
// Patch global scope to imitate browser environment.
You can’t perform that action at this time.