Skip to content

Instantly share code, notes, and snippets.

View sjwilliams's full-sized avatar

Josh Williams sjwilliams

View GitHub Profile
@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 / gist:3901349
Created October 16, 2012 19:15
iOS hardware/software detection. iOS versions and apple hardware type. in javascript.
/*
IOS CHECK
Based on: http://stackoverflow.com/questions/8348139/detect-ios-version-less-than-5-with-javascript
*/
(function(){
NYTD.NYTMM.iOS = false;
NYTD.NYTMM.iOSInfo = {
userAgent: null,
version: null, // major versions of iOS: 4,5,6
minor: null, // minor versions: 1, for 5.1
@sjwilliams
sjwilliams / gist:3903157
Created October 17, 2012 01:03 — forked from lucasfais/gist:1207002
Sublime Text 2 Cheat Sheet. Shortcuts, including Vintage mode.

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘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
sjwilliams / gist:3929462
Created October 22, 2012 03:18
Merge an array of jQuery objects into a single usable selector
// Based on pieces from this thread:
// http://stackoverflow.com/questions/1881716/merging-jquery-objects
// use: var currentRowEls = []; // array of various jQ ojbects
// $.mergeSelectors(currentRowEls).css({width:'200px'});
(function($){
$.mergeSelectors = function(objs) {
var ret = objs.shift();
while (objs.length) {
ret = ret.add(objs.shift());
@sjwilliams
sjwilliams / gist:4114955
Created November 19, 2012 23:47
jQuery, remove classes by regex match
this.$portfolioItems.removeClass(function(index, cssClass){
return (cssClass.match (/(?:(?:row|col)-[\d]|last-row|first-row)/) || []).join(' ');
})
@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
brew install ffmpeg --with-libvorbis --with-nonfree --with-gpl --with-libvpx --with-pthreads --with-libx264 --with-libfaac --with-libtheora
@sjwilliams
sjwilliams / gist:5137855
Created March 11, 2013 21:19
Unix Tricks
Source: http://mmb.pcb.ub.es/~carlesfe/unix/tricks.txt
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!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command

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
@sjwilliams
sjwilliams / imagesToMp4
Created January 20, 2014 22:41
rename a folder of image to be sequential, then convert to an mp4
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