Skip to content

Instantly share code, notes, and snippets.

@manigandham
manigandham / rich-text-html-editors.md
Last active July 23, 2024 12:07
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

@mikaelbr
mikaelbr / destructuring.js
Last active August 20, 2024 11:27
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
anonymous
anonymous / node-upgrade.bash
Created November 7, 2013 12:08
# 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}
@stucox
stucox / mutationobserver.js
Created March 24, 2013 09:36
Mutation Observer feature detection
// 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'];
}
}
@TastyToast
TastyToast / handlebars-truncate-helper.js
Last active April 21, 2021 09:08
Truncate helper for Handlebars.js
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;
@fnando
fnando / node.sh
Created June 29, 2012 03:42
Install Node.js
#!/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
@fnando
fnando / git.sh
Created June 29, 2012 03:40
Install Git
#!/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
@fnando
fnando / ruby.sh
Created June 29, 2012 03:38
Install Ruby
#!/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
@pithyless
pithyless / gist:1208841
Created September 10, 2011 21:49
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion

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(){