Install Python
$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7
Symlinks...
/** | |
* `and` plugins for jQuery | |
* --- | |
* Pretty intuitive. Enables stuff like: | |
* $('a').andChildren(); | |
* Quicker & easier than: | |
* $('a').children().andSelf() | |
*/ | |
(function(){ |
Install Python
$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7
Symlinks...
#!/usr/bin/env bash | |
INSTALL_DIR="${INSTALL_DIR:-/opt/local}" | |
VERSION=$2 | |
APP_NAME="ruby" | |
URL="http://ftp.ruby-lang.org/pub/ruby/ruby-$VERSION.tar.bz2" | |
PREFIX="$INSTALL_DIR/$APP_NAME/$VERSION" | |
CURRENT="$INSTALL_DIR/$APP_NAME/current" | |
TGZ="$INSTALL_DIR/src/$(basename $URL)" | |
COMMAND=$1 |
#!/usr/bin/env bash | |
INSTALL_DIR="${INSTALL_DIR:-/opt/local}" | |
VERSION=$2 | |
APP_NAME="git" | |
URL="http://git-core.googlecode.com/files/git-$VERSION.tar.gz" | |
PREFIX="$INSTALL_DIR/$APP_NAME/$VERSION" | |
CURRENT="$INSTALL_DIR/$APP_NAME/current" | |
TGZ="$INSTALL_DIR/src/$(basename $URL)" | |
COMMAND=$1 |
#!/usr/bin/env bash | |
INSTALL_DIR="${INSTALL_DIR:-/opt/local}" | |
VERSION=$2 | |
APP_NAME="node" | |
URL="http://nodejs.org/dist/v$VERSION/node-v$VERSION.tar.gz" | |
PREFIX="$INSTALL_DIR/$APP_NAME/$VERSION" | |
CURRENT="$INSTALL_DIR/$APP_NAME/current" | |
TGZ="$INSTALL_DIR/src/$(basename $URL)" | |
COMMAND=$1 |
Handlebars.registerHelper ('truncate', function (str, len) { | |
if (str.length > len) { | |
var new_str = str.substr (0, len+1); | |
while (new_str.length) { | |
var ch = new_str.substr ( -1 ); | |
new_str = new_str.substr ( 0, -1 ); | |
if (ch == ' ') { | |
break; |
// http://www.w3.org/TR/dom/ | |
// http://updates.html5rocks.com/2012/02/Detect-DOM-changes-with-Mutation-Observers | |
// https://developer.mozilla.org/en-US/docs/DOM/MutationObserver | |
var MutationObserver = (function () { | |
var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''] | |
for(var i=0; i < prefixes.length; i++) { | |
if(prefixes[i] + 'MutationObserver' in window) { | |
return window[prefixes[i] + 'MutationObserver']; | |
} | |
} |
# usage | |
# `node-upgrade` to upgrade to the latest stable version | |
# `node-upgrade <node-version` to upgrade to specific version | |
# eg. `node-upgrade 0.10.17` | |
function node-upgrade { | |
if [[ -z $1 ]]; then | |
sudo n stable | |
else | |
sudo n ${1} |
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
These use separate document structures instead of HTML, some are more modular libraries than full editors