Skip to content

Instantly share code, notes, and snippets.

View DavidSouther's full-sized avatar
💭
You can statistics syntax, not semantics.

David Souther DavidSouther

💭
You can statistics syntax, not semantics.
View GitHub Profile
@DavidSouther
DavidSouther / gist:5224974
Last active December 15, 2015 07:39
Notes for "Github Workflow"
Github Flow
Central project repository: "upstream"
Developer GH repository: "origin"
Developer local repository: "localhost"
Init:
Project:
Create branches on "upstream"
master
@DavidSouther
DavidSouther / canvas.js
Last active December 14, 2015 05:29 — forked from anonymous/canvas.js
(function(){
/*
Get a new SVG canvas, with margins and scales. Pass an object as `options` to
set values. Defaults:
{
size: # Size of SVG. Returned size will be smaller by the size of the margins.
width: 960
height: 500
margin: # Margins for the graphic.
@DavidSouther
DavidSouther / .db.json
Created November 14, 2015 14:10
Sample archives database
{"tape_1":{"label":"Tape 1","family":"tapes","medium":"3/4\" Tape","notes":"","stories":[{"slug":"Slug 1","date":"2015-11-07T00:17:32.806Z","format":"Unknown","runtime":"0:00","notes":"","reporter":"Unknown","photographer":"Unknown"},{"slug":"Slug 1","date":"2015-11-07T00:17:32.806Z","format":"Unknown","runtime":"0:00","notes":"","reporter":"Unknown","photographer":"Unknown"},{"slug":"Slug 1","date":"2015-11-07T00:17:32.806Z","format":"Unknown","runtime":"0:00","notes":"","reporter":"Unknown","photographer":"Unknown"},{"slug":"Slug 1","date":"2015-11-07T00:17:32.806Z","format":"Unknown","runtime":"0:00","notes":"","reporter":"Unknown","photographer":"Unknown"},{"slug":"Slug 1","date":"2015-11-07T00:17:32.806Z","format":"Unknown","runtime":"0:00","notes":"","reporter":"Unknown","photographer":"Unknown"},{"slug":"Slug 1","date":"2015-11-07T00:17:32.806Z","format":"Unknown","runtime":"0:00","notes":"","reporter":"Unknown","photographer":"Unknown"},{"slug":"Slug 1","date":"2015-11-07T00:17:32.806Z","format":"Unkn
{
"name": "...",
"version": "...",
"description": "KTVQ Video Archive Management.",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"repository": {
"type": "git",
"url": "git@github.com:DavidSouther/rupert.git"
},
@DavidSouther
DavidSouther / gist:3220550
Created July 31, 2012 21:06
Timing functions in LiveScript
polynomial = (coefficients) ->
n = 0
coefficients = reverse coefficients
(x = n++) ->
sum = 0
for c, i in coefficients
sum += c * Math.pow(x, i)
sum
linear = (a = 1, b = 0) ->
@DavidSouther
DavidSouther / firefox-install.sh
Created April 29, 2012 13:50
Install Firefox releases
mkdir --parents /home/$USER/devel/firefox
mkdir --parents /home/$USER/bin
pushd /home/$USER/devel/firefox
for ff in $(seq 4 13) ; do
wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$ff.0/linux-$(uname -p)/en-US/firefox-$ff.0.tar.bz2
tar xvf firefox-$ff.0.tar.bz2
mv firefox firefox-$ff
/home/$USER/devel/firefox/firefox-$ff/firefox -no-remote -CreateProfile firefox-$ff.0
/**
* Calculate the specificity of a selectorList (the sum of the count of
* matching attributes).
*/
var specificity = function(selectorList) {
var spec = 0;
goog.array.forEach(selectorList, function(selector){
spec += selector.hierarchy?1:0;
spec += selector.type?1:0;
spec += selector.id?1:0;
@DavidSouther
DavidSouther / drag-directive.js
Last active September 3, 2015 17:20
An Angular 1.x dragging directive. The drag directive has several callback attributes available, the main being drag itself. For every drag event, the component has an opportunity to update itself.
var log = debug('draggable');
function Draggable(element, scope){
var apply;
if(scope.$apply){
apply = function(fn){
return function(){
var context = this;
var args = arguments;
@DavidSouther
DavidSouther / drag-directive.js
Created September 3, 2015 17:04
A hastily sanitized demo of a Draggable directive.
var log = debug('draggable');
function Draggable(element, scope){
var apply;
if(scope.$apply){
apply = function(fn){
return function(){
var context = this;
var args = arguments;
var config = {
name: 'rupert-auth-example',
hostname: 'localhost',
stassets: {
root: './src/client'
},
server: {
root: './src/server'
},
mongo: {