Skip to content

Instantly share code, notes, and snippets.

View gerad's full-sized avatar

Gerad Suyderhoud gerad

View GitHub Profile
@gerad
gerad / chrome_form_submission_event_bug.html
Created March 16, 2011 19:47
shows a bug with chrome event handling
<form onsubmit='alert("should not get here");'>
<input id="text" type="text" placeholder="type something and hit enter">
</form>
<script>
var t = document.getElementById('text');
t.addEventListener('keydown', function(e) {
if (e.which === 13) { // hitting return
alert('form submission should be prevented');
e.stopPropagation();
@gerad
gerad / npm-hacks
Created March 11, 2011 03:49
hacky way to run forked npm modules on no.de
[node@gerad ~]$ mkdir npm-hacks
[node@gerad ~]$ cd npm-hacks/
[node@gerad ~/npm-hacks]$ git clone https://github.com/fortnightlabs/twitter-js
Initialized empty Git repository in /home/node/npm-hacks/twitter-js/.git/
remote: Counting objects: 78, done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 78 (delta 27), reused 0 (delta 0)
Unpacking objects: 100% (78/78), done.
[node@gerad ~/npm-hacks]$ cd twitter-js/
[node@gerad ~/npm-hacks/twitter-js]$ npm link .
@gerad
gerad / npm install mongodb
Created March 10, 2011 17:24
npm install mongodb fails on no.de
[node@gerad ~]$ npm install mongodb
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info fetch http://registry.npmjs.org/mongodb/-/mongodb-0.9.1.tgz
npm info calculating sha1 /tmp/npm-1299777263646/1299777263646-0.11996227549389005/tmp.tgz
npm info shasum 0b4c97289d9c88fc726a9993a8632d2ebe3284d6
npm info calculating sha1 /home/node/.node_libraries/.npm/.cache/mongodb/0.9.1/package.tgz
npm info shasum 5ea811dd1b55ae50b5ebda38c853e7548c7d86db
npm info preinstall [email protected]
$(function() {
$(window).hashchange(function() {
var tab = window.location.hash.replace(/^#/, '') || initial;
switchTabs(tab);
}).hashchange(); // trigger on page load
});
@gerad
gerad / ec2-ubuntu.sh
Created September 18, 2010 19:38
easy ec2 ubuntu server creation
#! /usr/bin/env bash
if [ -z $1 ]; then
echo "ec2-ubuntu - easy ec2 ubuntu server creation"
echo "Usage: $0 instance-name [instance-type [ami [region]]]"
exit
fi
instancename=$1
instancetype=${2:-'t1.micro'}
ami=${3:-'ami-1234de7b'}
@gerad
gerad / install-openinviter-ubuntu.md
Created September 15, 2010 05:45
setup openinviter on ec2

setup the instance

locally

go to the amazon web interface

note your AWS_USER_ID in the upper right hand corner. create a new AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

@gerad
gerad / build_node.sh
Created August 16, 2010 02:14
getting started with node
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
@gerad
gerad / add_partner_id_to_sources.sh
Created August 11, 2010 22:58
command line rails migration options example
script/generate migration add_partner_id_to_sources partner_id:string
@gerad
gerad / appengine_console.py
Created April 28, 2010 20:48
Setup an interactive console for Google AppEngine - similar to script/console in Rails.
"""Convenience wrapper for starting an interactive appengine console."""
import os
import sys
from subprocess import call
DIR_PATH = os.path.abspath(os.path.dirname(os.path.realpath('/usr/local/bin/dev_appserver.py')))
EXTRA_PATHS = [
DIR_PATH,
@gerad
gerad / application.js
Created February 5, 2010 22:55
hoptoad report javascript errors
// in application.js
window.onerror = function(msg, url, line) {
var location = String(window.location);
new Ajax.Request('/error/error', {
method: 'POST',
parameters: {
message: msg,
url: url || location,
line: line,
location: location,