Skip to content

Instantly share code, notes, and snippets.


William Crandell CrandellWS

View GitHub Profile
mbostock / .block
Last active Oct 2, 2020
Epicyclic Gearing
View .block
license: gpl-3.0
jasny /
Last active Oct 23, 2020
Split MySQL dump SQL file into one file per table or extract a single table
# Split MySQL dump SQL file into one file per table
# based on
if [ $# -lt 1 ] ; then
mbostock / .block
Last active Jun 11, 2018
Asynchronous Queue
View .block
license: gpl-3.0
olimortimer / gist:3032672
Created Jul 2, 2012
JS: jQuery Replace HREF Query String
View gist:3032672
$('#pageLink').attr('href', $('#pageLink').attr('href').replace(/((\?|&)id\=)[0-9]*/, '$1' + '123'));
RichardSlater / underwater.js
Created Oct 9, 2012
Unity3d Underwater Effect
View underwater.js
//This script enables underwater effects. Attach to main camera.
//Define variables
var underwaterLevel = 7;
//The scene's default fog settings
private var defaultFog;
private var defaultFogColor;
private var defaultFogDensity;
private var defaultSkybox;
mattratleph /
Last active Oct 21, 2020 — forked from roothybrid7/
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)
:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)
NKjoep /
Last active Sep 27, 2016
My Bash Prompt
# Color Reset
Color_Off="\033[0m" # Text Reset
# Regular Colors
Black="\033[0;30m" # Black
Red="\033[0;31m" # Red
Green="\033[0;32m" # Green
Yellow="\033[0;33m" # Yellow
Blue="\033[0;34m" # Blue
Purple="\033[0;35m" # Purple
mbostock / .block
Last active Oct 28, 2020
Collapsible Tree
View .block
license: gpl-3.0
nasirkhan / git command.markdown
Last active Oct 5, 2020
`git` discard all local changes/commits and pull from upstream
View git command.markdown

git discard all local changes/commits and pull from upstream

git reset --hard origin/master

git pull origin master

mbostock /
Last active Nov 5, 2017
Infinite Queue

A little demo of an infinitely long-living queue with 6 parallel slots for tasks. The sentinel task that never invokes the callback prevents the queue from ending, even if there are not any currently-active tasks.

There is a downside to this approach, however, which is that the queue’s internal task results array increases in length by one with each task, even though in this case the queue’s results are never triggered. Thus, be careful using this pattern if you really expect the queue to live indefinitely. Alternatively, it might be worth extending Queue’s minimal API to allow tasks to be processed without tracking their return value.

You can’t perform that action at this time.