Skip to content

Instantly share code, notes, and snippets.

Josh Williams sjwilliams

View GitHub Profile
sjwilliams / gist:2051376
Created Mar 16, 2012 — forked from brianboyer/gist:1696819
Lion dev environment notes
View gist:2051376
Homebrew (
brew install postgres
brew install gdal --with-postgres (EDIT THE FORMULA FIRST, see
brew install postgis
edit /etc/paths to put /usr/local/bin on top, so that lion's psql doesnt win
PostGIS templates (based on
createdb template_postgis -E UTF8
createlang plpgsql template_postgis
psql -d template_postgis -f /usr/local/share/postgis/postgis.sql
sjwilliams / gist:3901349
Created Oct 16, 2012
iOS hardware/software detection. iOS versions and apple hardware type. in javascript.
View gist:3901349
Based on:
NYTD.NYTMM.iOS = false;
userAgent: null,
version: null, // major versions of iOS: 4,5,6
minor: null, // minor versions: 1, for 5.1
sjwilliams / gist:3903157
Created Oct 17, 2012 — forked from lucasfais/gist:1207002
Sublime Text 2 Cheat Sheet. Shortcuts, including Vintage mode.
View gist:3903157

Sublime Text 2 – Useful Shortcuts (Mac OS X)


⌘T go to file
⌘⌃P go to project
⌘KB toggle side bar
⌘⇧P command prompt
⌃ ` python console
⌘⇧N new window (useful for new project)
sjwilliams / gist:3929462
Created Oct 22, 2012
Merge an array of jQuery objects into a single usable selector
View gist:3929462
// Based on pieces from this thread:
// use: var currentRowEls = []; // array of various jQ ojbects
// $.mergeSelectors(currentRowEls).css({width:'200px'});
$.mergeSelectors = function(objs) {
var ret = objs.shift();
while (objs.length) {
ret = ret.add(objs.shift());
sjwilliams / gist:4114955
Created Nov 19, 2012
jQuery, remove classes by regex match
View gist:4114955
this.$portfolioItems.removeClass(function(index, cssClass){
return (cssClass.match (/(?:(?:row|col)-[\d]|last-row|first-row)/) || []).join(' ');

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
View install ffmpeg for html5 video with homebrew
brew install ffmpeg --with-libvorbis --with-nonfree --with-gpl --with-libvpx --with-pthreads --with-libx264 --with-libfaac --with-libtheora
View gist:5137855
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command <' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
View gist:7101704

Sublime Text 2 – Useful Shortcuts (Mac OS X)


⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
sjwilliams / imagesToMp4
Created Jan 20, 2014
rename a folder of image to be sequential, then convert to an mp4
View imagesToMp4
find . -name '*.JPG' | awk 'BEGIN{ a=1 }{ printf "mv %s %04d.jpg\n", $0, a++ }' | bash;
ffmpeg -r 24 -f image2 -s 1920x1280 -i %4d.jpg -vcodec libx264 -crf 15 test.mp4
You can’t perform that action at this time.