Skip to content

Instantly share code, notes, and snippets.

View donmccurdy's full-sized avatar

Don McCurdy donmccurdy

View GitHub Profile
@donmccurdy
donmccurdy / googlemaps_and_deckgl.js
Last active February 21, 2019 21:14
Maps API + DeckGL
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 October 31, 2018 20:45
example CSV transformation in Node.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 January 15, 2025 22:26
Example Node.js glTF conversion script, using three.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.
@donmccurdy
donmccurdy / merge-morph-attributes.patch
Created August 20, 2018 00:30
Merge THREE.BufferGeometry morph attributes.
diff --git a/examples/js/utils/BufferGeometryUtils.js b/examples/js/utils/BufferGeometryUtils.js
index f1ce126f6..4c1edcea3 100644
--- a/examples/js/utils/BufferGeometryUtils.js
+++ b/examples/js/utils/BufferGeometryUtils.js
@@ -399,6 +399,7 @@ THREE.BufferGeometryUtils = {
// attributes and new attribute arrays
var attributeNames = Object.keys( this.attributes );
var attrArrays = {};
+ var morphAttrArrays = {};
var newIndices = [];
@donmccurdy
donmccurdy / gltf-deduplicate-textures.js
Created August 5, 2018 05:38
CLI script for de-duplicating images references in a glTF asset.
const Listr = require('listr');
const program = require('commander');
const path = require('path');
const fs = require('fs');
const tasks = new Listr([
{
title: 'reading file',
task: (ctx) => {
if (!ctx.program.output) {
@donmccurdy
donmccurdy / MAX_BONE_WEIGHTS.md
Last active March 25, 2025 06:31
Vertex bone influence limits for 3D tools
engine max influences / vertex
BabylonJS 8
Cesium 4
Godot 8
Love3D 4
three.js 4
UE4 8
Unity 1, 2, 4, or Unlimited
Windows MR 4
@donmccurdy
donmccurdy / feature-collection.geojson
Created May 22, 2018 22:55
feature-collection.geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@donmccurdy
donmccurdy / agnoster_lite.zsh-theme
Last active October 8, 2021 02:41
Minimal fork of Agnoster theme for oh-my-zsh.
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
@donmccurdy
donmccurdy / Dockerfile
Created February 10, 2018 23:53
Docker image for node:8-xenial
FROM buildpack-deps:xenial
RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
# gpg keys listed at https://github.com/nodejs/node#release-team
RUN set -ex \
&& for key in \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
@donmccurdy
donmccurdy / gce-msdf.md
Last active January 31, 2018 16:53
compute engine msdf-gen setup

Installing and running msdf-bmfont-xml on Google Compute Engine.

New

Starting from Ubuntu 16.04 LTS image.

# install node.js
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
nvm install 8