This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By weepy | |
function diff(b,a) { | |
var d={} | |
// additions | |
var tb = typeOf(b) | |
var ta = typeOf(a) | |
if(ta != tb) | |
return b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
class Spiderz | |
#root should be like http://www.google.com (i.e. with http://) | |
def initialize(root) | |
@followed = {} | |
@root = root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HookManager = function() { | |
this.list = {}; | |
this.hookTable = {} | |
} | |
HookManager.prototype = { | |
add: function(n, type, fn, priority, off) { | |
if(typeof type != "string") | |
log("Cannot add type as hook: " + n) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// border-radius | |
// Jonah Fox | |
// MIT Licensed | |
// Use like : $(".myClass").borderRadius() will attempt to apply curved corners as per the elements -moz-border-radius attribute | |
// Good: | |
// - supports textured forgrounds and backgrounds | |
// - maintains layouts | |
// - very easy to use | |
// - IE6 and IE7 | |
// Bad: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// border-radius | |
// Jonah Fox | |
// MIT Licensed | |
// Use like : $(".myClass").borderRadius() will attempt to apply curved corners as per the elements -moz-border-radius attribute | |
// Good: | |
// - supports textured forgrounds and backgrounds | |
// - maintains layouts | |
// - very easy to use | |
// - IE6 and IE7 | |
// Bad: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def post_redirect_to url, params | |
inputs = params.map do |param, val| | |
"<input id=\"#{param}\" name=\"#{param}\" type=hidden value=\"#{val}\"></input>" | |
end.join | |
script = "<script>window.onload = function() { document.forms[0].submit() }</script>" | |
render :text => "<form action=#{url}>#{inputs}</form>" + script , :layout => false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fill(sq, end_condition) { | |
var matrix = {} | |
var queue = [sq] | |
while(queue.length > 0) { | |
var sq = queue.shift() | |
var ns = neighbours(sq, matrix) | |
if(end_condition ( ns ) { | |
return true | |
} | |
queue = queue.concat(ns) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Hooks */ | |
var Hooks = function() { | |
this.list = {}; | |
this.hookTable = {}; | |
this.hookNum = 0; | |
} | |
Hooks.prototype = { | |
add: function(names, fn, priority, off) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
GENERAL | |
* tab-spacing: 2 (spaces) | |
* One file per class / concept (they can always be concatenated) | |
* Each class should avoid being dependent on another | |
BRACES | |
if { | |
doStuff() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inspired by http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost | |
RUBYGEMS="rubygems-1.3.5" | |
RUBYGEMS_URL="http://rubyforge.org/frs/download.php/60718/$RUBYGEMS.tgz" | |
PASSENGER_VERSION="2.2.5" | |
THIS_HOST="www.yourhost.com" | |
APP_NAME="my_new_app" |
OlderNewer