Skip to content

Instantly share code, notes, and snippets.

All blockchain all the time right now...

Cliff Hall cliffhall

All blockchain all the time right now...
View GitHub Profile
cliffhall / cordwood.js
Last active Dec 3, 2019
Extract substrings of predetermined a length, along with any remainder.
View cordwood.js
* String.cordwood
* Add a String prototype method to split string into an array of
* substrings of a given length, along with any remainder.
* Example usage:
* let paragraph = 'The quick brown fox jumps over the lazy dog. It barked.';
* let stack = paragraph.cordwood(10)
* console.log(stack)

The Sinewav3 Plugin example 'Sparks Fly' creates a particle system simulating sparks which dim as they age, while moving in a realistic fashion.

A number of settings are exposed for the particle system emitter and its movement as well as the protoypical spark particle and its movement. The code demonstrates the use of audio modulation and easing.

Learn more about this plugin here:

cliffhall /
Last active Apr 17, 2018
Sinewav3 Plugin Example 'Tentacles'
cliffhall / index.js
Last active Nov 29, 2018
Using Firebase Cloud Functions to Manage a Compound Key Index
View index.js
* Function: indexArtist
* Triggered by writes to: /artists/:id
* Responds by writing to: /indexes/artist_by_genre (once for each Genre the Artist has chosen)
* If there was a previous value, all associated index entries are removed first.
* So, if the artist display name has changed or the genre list has changed,
* the index will be properly synchronized.
cliffhall / nuke-firebase-db-and-users-referenced-therein.js
Last active Sep 24, 2018
Nuke a Firebase Database and All User Accounts Referenced Therein
View nuke-firebase-db-and-users-referenced-therein.js
// NOTE: Accounts that are not represented in your /users node will not be deleted!
// BLOG: There are other approaches, see:
"use strict";
// Get credentials and initialize firebase app
console.log("With the power vested in the admin user, lay waste the database and all its users!");
let admin = require("firebase-admin");
let serviceAccount = require([__dirname, "service-account-key.json"].join('/'));
credential: admin.credential.cert(serviceAccount),

This demo builds on previous gists in this series to render an audio-modulated WebGL animation, and output a 48 FPS, 1080p, HD video utilizing:

  • HTML5's Web Audio API for analysing an audio file.
  • HTML5's Web Worker API for offloading communications between the web page and the server to separate thread.
  • for sending messages (including image and audio files) between client and server.
  • Node.js for the server process for storing generated images and uploaded audio and creating the final video.
  • FFMpeg for the actual video creation.
  • Fluent-ffmpeg for making the configuration and execution of FFMpeg commands easy peasy.
  • @ffmpeg-installer/ffmpeg for installing the correct version of FFMpeg for the hardware this demo runs on.
  • mkdirp for creating the folder path for each client's data, including any missing nodes in the path.
cliffhall /
Last active Dec 29, 2017
A Three.js / / Node.js render and transmit test.

This example renders thirty frames of the Three.js 'your first scene' example and sends them to a Node.js microservice, which saves them to the filesystem.


  • Creates the scene, camera, renderer, and kicks off the render loop, which stops after 30 frames have been rendered.
  • As an optimization, it doesn't add the Three.js canvas to the browser DOM, rendering it offscreen, but reporting progress.
  • It extracts the data for each frame using canvas.toDataURL(), sending that to a web worker process for transmission.
  • When all frames are rendered, it sends a 'done' message to the worker.


  • Sets up a queue for incoming frames to be sent to the server.
cliffhall /
Last active Nov 5, 2016
A simple test with client and server (Node.js) parts.
You can’t perform that action at this time.