Skip to content

Instantly share code, notes, and snippets.

Avatar

William Crandell CrandellWS

View GitHub Profile
@mbostock
mbostock / .block
Last active Oct 2, 2020
Epicyclic Gearing
View .block
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/epicyclic-gearing
@jasny
jasny / mysql_splitdump.sh
Last active Oct 23, 2020
Split MySQL dump SQL file into one file per table or extract a single table
View mysql_splitdump.sh
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####
if [ $# -lt 1 ] ; then
echo "USAGE $0 DUMP_FILE [TABLE]"
exit
@mbostock
mbostock / .block
Last active Jun 11, 2018
Asynchronous Queue
View .block
license: gpl-3.0
@olimortimer
olimortimer / gist:3032672
Created Jul 2, 2012
JS: jQuery Replace HREF Query String
View gist:3032672
// www.website.com/page?id=100
$('#pageLink').attr('href', $('#pageLink').attr('href').replace(/((\?|&)id\=)[0-9]*/, '$1' + '123'));
// www.website.com/page?id=123
@RichardSlater
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
mattratleph / vimdiff.md
Last active Oct 21, 2020 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet
View vimdiff.md

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
NKjoep / myprompt-bash.sh
Last active Sep 27, 2016
My Bash Prompt
View myprompt-bash.sh
# 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
mbostock / .block
Last active Oct 28, 2020
Collapsible Tree
View .block
license: gpl-3.0
redirect: https://observablehq.com/@d3/d3-collapsible-tree
@nasirkhan
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
mbostock / README.md
Last active Nov 5, 2017
Infinite Queue
View README.md

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.