Skip to content

Instantly share code, notes, and snippets.

View sjwilliams's full-sized avatar

Josh Williams sjwilliams

View GitHub Profile
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@sjwilliams
sjwilliams / git-go.js
Last active September 1, 2015 20:08 — forked from gka/git-go.js
#!/usr/bin/env node
var cmds = [];
if (process.argv.length < 3) {
console.log('You need to provide a commit message!');
process.exit(-1);
}
cmds.push('git add -A');
cmds.push('git add -u');
@sjwilliams
sjwilliams / gist:2051376
Created March 16, 2012 17:43 — forked from brianboyer/gist:1696819
Lion dev environment notes
Homebrew (https://github.com/mxcl/homebrew/wiki/installation)
brew install postgres
brew install gdal --with-postgres (EDIT THE FORMULA FIRST, see https://github.com/mxcl/homebrew/issues/8301)
brew install postgis
edit /etc/paths to put /usr/local/bin on top, so that lion's psql doesnt win
PostGIS templates (based on https://wiki.archlinux.org/index.php/PostGIS)
createdb template_postgis -E UTF8
createlang plpgsql template_postgis
psql -d template_postgis -f /usr/local/share/postgis/postgis.sql
@sjwilliams
sjwilliams / sublime_text_2_useful_shortcuts.md
Created November 21, 2012 00:02 — forked from nuxlli/sublime_text_2_useful_shortcuts.md
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
umd(function(require, exports, module) {
//...
},'my-module');function umd(fn,n){
if(typeof define=='function')return define(fn); // AMD
if(typeof module=='object')return fn(require,exports,module); // CommonJS
var m={exports:{}};window[n]=fn(function(n){return window[n];},m.exports,m)||m.exports; // window
}
@sjwilliams
sjwilliams / install_ffmpeg_ubuntu.sh
Created March 2, 2017 03:20 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@sjwilliams
sjwilliams / js-observables-binding.md
Created April 18, 2017 17:50 — forked from austinhyde/js-observables-binding.md
Vanilla JavaScript Data Binding

Observables

You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5

setN(10);

@sjwilliams
sjwilliams / GIF-Screencast-OSX.md
Created July 14, 2017 14:50 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

const isAutoplaySupported = function (callback) {
var timeout;
var waitTime = 200;
var retries = 5;
var currentTry = 0;
var elem = document.createElement('video');
var elemStyle = elem.style;
function testAutoplay(arg) {
currentTry++;