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 DropDownMenu(element) { | |
element.addEventListener('mouseover mouseout', this, false); | |
} | |
DropDownMenu.prototype = { | |
handleEvent: function(e) { | |
switch(e.type) { | |
'mouseover': this.open(e); break; | |
'mouseout': this.close(e); break; | |
} |
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 'twitter' | |
oauth = Twitter::OAuth.new('ctoken', 'csecret') | |
oauth.authorize_from_access('atoken', 'asecret') | |
twitter = Twitter::Base.new(oauth) | |
annotations = [ | |
{:coffee => {:temperature => "hot", :effectiveness => "crack"}}, | |
{:music => { |
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
Power Lunch - Har Mar Superstar | |
Chemical Beats (Dave Clarke Remix) - Chemical Brothers | |
When You Hear The Bassline - Major Lazer | |
Hey (Black Noise Remix) - Laidback Luke/Diplo | |
Chainsaw Calligraphy (Propatingz Crunk Massacre Remix) - 16 Bit | |
Breathe (Number9nine Remix) - The Prodigy | |
Alert - Liquid Stranger | |
Technophobe - N-Type & The Others | |
Explicit - Emalkay | |
Bow E3 - Wiley |
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
// DOM Builder plugin for jQuery | |
// (c) Dan Webb (dan@massiverobot.co.uk) | |
// | |
// $.build(function() { | |
// | |
// div({ 'class': 'module' }, | |
// h1('A list of stuff'), | |
// ul( | |
// li('item 1'), | |
// li('item 2'), |
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 mandatory?(method) | |
if @object.class.respond_to? :reflect_on_validations_for | |
@object.class.reflect_on_validations_for(method).any? { |val| val.macro == :validates_presence_of } | |
end | |
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
jQuery(function($) { | |
if (typeof $.keys != 'function') { | |
$.extend({ | |
keys: function(obj) { | |
var a = []; | |
$.each(obj, function(k){ a.push(k) }); | |
return a; | |
} | |
}); | |
} |
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
jQuery(function($) { | |
var SERVICES = { | |
'twitpic.com': function(path) { | |
var code = path.match(/\/([a-zA-Z0-9]+)/)[1]; | |
return "http://twitpic.com/show/thumb/" + code; | |
} | |
}; | |
var expression = $.keys(SERVICES).join('|'); |
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
$.fn.serializeHash = function() { | |
var arr = this.serialize(); | |
var hash = {}; | |
$.each(arr.split('&'), function(i, pair) { | |
var items = pair.split('='); | |
var key = unescape(items[0]), value = unescape(item[1]); | |
hash[key] = value; | |
}); |
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' | |
playlist = open('http://www.soundboard.com/playlist/REpFbW1hMjAwODQyMTQw_FjHigNpCqbI.xml') | |
doc = Hpricot::XML(playlist.read) | |
doc.search('//location').each do |node| | |
`curl -O #{node.inner_text}` | |
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
state :new, :default => true do | |
handle :queue! do | |
enqueue | |
transition_to :queued | |
save! | |
end | |
handle :fetch_ga_data! do | |
fetch_ga_data | |
extract_terms |