Skip to content

Instantly share code, notes, and snippets.

Josh Williams sjwilliams

View GitHub Profile
@sjwilliams
sjwilliams / gist:2051376
Created Mar 16, 2012 — forked from brianboyer/gist:1696819
Lion dev environment notes
View gist:2051376
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 Oct 16, 2012
iOS hardware/software detection. iOS versions and apple hardware type. in javascript.
View gist:3901349
/*
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 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)

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 Oct 22, 2012
Merge an array of jQuery objects into a single usable selector
View gist:3929462
// 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 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(' ');
})
View sublime_text_2_useful_shortcuts.md

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
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
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
View gist:7101704

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 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.