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
/**
* 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 / 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
@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 / 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 / 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 / overview.md
Last active April 4, 2016 02:00
Space Naval Sim

cc by-sa 3.0

OUTDATED

It now lives here.

Premise

Take command of a Stellar Naval Vessel (SNV) in a universe with physics from the CoDominium universe. Manage navigation, weapons, science, and more as you lead your crew on various missions ranging from military engagements to interstellar diplomacy to scientific exploration. Earn your place in the admiralty and take on larger missions, eventually controlling armadas and fleets at a galactic level.

// based on https://www.shadertoy.com/view/4dXGR4 by flight404, itself
// based on https://www.shadertoy.com/view/lsf3RH by trisomie21
float snoise(vec3 uv, float res) {
const vec3 s = vec3(1e0, 1e2, 1e4);
uv *= res;
vec3 uv0 = floor(mod(uv, res))*s;
vec3 uv1 = floor(mod(uv+vec3(1.), res))*s;
    Workflows!
        Internals!
Tips & Tricks! 
  Resolving conflicts!
       Reading git output! 

Git - Top down!

[git-top-down]$ git hub-clone
/home/southerd/.ghf/bin/git-hub-clone <org/repo>: Initialize a new working repository, and set git-hubflow configurations.
<org/repo>: The organization and repository name to clone from.
[git-top-down]$ git hub-clone github-flow/recipes
Fork at https://github.com/DavidSouther/recipes
Project cloned into /home/southerd/devel/southerd/git-top-down/recipes
[git-top-down]$ cd recipes/
[recipes (master)]$ ls
README.md
Rebase with unclean working directory
"unclean"
- staged changes
- unstaged changed
- untracked files
Accidental commit in middle of pull --rebase
Pulling commits out of a feature branch