Skip to content

Instantly share code, notes, and snippets.

View Craigmoore's full-sized avatar

Craig Moore Craigmoore

View GitHub Profile
@Craigmoore
Craigmoore / GLTFExporter.js
Created February 27, 2020 22:55
NodeJS adapted version of the ThreeJS GLTFExporter, using npm vblob and canvas, based on mr doobs GLTFExporter
const THREE = require('three');
const { createCanvas, loadImage } = require('canvas')
const { Blob, FileReader } = require('vblob');
// Patch global scope to imitate browser environment.
global.window = global;
global.Blob = Blob;
global.FileReader = FileReader;
global.THREE = THREE;
@Craigmoore
Craigmoore / Promise.decide.js
Last active May 4, 2017 10:41
Decide function for Promises.
Promise.decide = Promise.decide || function(iterablePromises, decidingFunction) {
// Assumes an iterable list of promises
var listOfProxyPromises = [], listOfResponseObjects = [];
for(var counter = 0; counter < iterablePromises.length; counter ++) {
var generatePromiseProxyWrapper = function(pCounter) {
return new Promise(function (resolve, reject) {