Skip to content

Instantly share code, notes, and snippets.

@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@RandomEtc
RandomEtc / README.mkd
Created September 28, 2010 00:11
smooth panning and zooming for polymaps
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@micahasmith
micahasmith / ckeditor-selection-wrap-with-rangy.js
Created November 11, 2011 20:08
Wrap a selection in CKEditor with Rangy
/**
* allows you to wrap or insert an html tag over a selection/range using rangy
* @param iframe the CKEditor iframe html element
* @param tagName string representation of the tag, such as 'a' for anchor
* @param withNodeFunc function to allow outside modification of the element before injecting/wrapping
*/
function wrapOrInsert(iframe, tagName, withNodeFunc) {
var iframedoc = iframe.contentDocument || iframe.contentWindow.document,
tag = iframedoc.createElement(tagName),
selection = rangy.getIframeSelection(iframe),
@rolo
rolo / gist:1481128
Created December 15, 2011 13:44
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
@paulirish
paulirish / rAF.js
Last active July 19, 2024 19:50
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@stevenklise
stevenklise / hack.sh
Created April 1, 2012 14:58 — forked from noahcrowley/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@pgherveou
pgherveou / iptables.rules
Created April 24, 2012 21:01 — forked from logicalparadox/iptables.rules
Getting Node.js process to run on port 80 without sudo
# NAT interface routing
*nat
# Setup
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [2:128]
:OUTPUT ACCEPT [2:120]
:POSTROUTING ACCEPT [2:120]
# Redirect port 80 to port 8080
@bbonamin
bbonamin / drag_drop.rb
Created July 17, 2012 14:18
Capybara drag and drop
shared_examples_for "driver with javascript support" do
before { @driver.visit('/with_js') }
describe '#find' do
it "should find dynamically changed nodes" do
@driver.find('//p').first.text.should == 'I changed it'
end
end
describe '#drag_to' do
@runemadsen
runemadsen / handy.sh
Last active May 30, 2018 18:42
Handy Bash Scripts
# show top top 10 most consuming processes
ps -A --sort -rss -o comm,pmem,pcpu | head -n 11
# show total size of folder
du -ch | grep total
# show remaning space left on HD
df -h
# show subfolders of current dir and their size