Skip to content

Instantly share code, notes, and snippets.

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;
}
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 => {
@danwrong
danwrong / 10
Created March 21, 2010 03:39
Twitter DJ Set Tracklist
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
// 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'),
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
jQuery(function($) {
if (typeof $.keys != 'function') {
$.extend({
keys: function(obj) {
var a = [];
$.each(obj, function(k){ a.push(k) });
return a;
}
});
}
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('|');
$.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;
});
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
state :new, :default => true do
handle :queue! do
enqueue
transition_to :queued
save!
end
handle :fetch_ga_data! do
fetch_ga_data
extract_terms