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
// The bestest event-delegator ever! | |
jQuery.fn.delegate = function(eType, r) { | |
return this.bind(eType, function(e) {var $t = $(e.target); for(var s in r) if($t.is(s)) return r[s].apply(this, arguments)}) | |
}; |
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
delegate: function(rules) { | |
return function(e) { | |
var target = $(e.target), parent = null; | |
for (var selector in rules) { | |
if (target.is(selector) || ((parent = target.parents(selector)) && parent.length > 0)) { | |
return rules[selector].apply(this, [parent || target].concat($.makeArray(arguments))); | |
} | |
parent = null; | |
} | |
} |
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
# Will yield sets of size, useful when you have to iterate over large sets | |
# if you have an array of 50k elements, running .each is slow. | |
def in_blocks_of(s) | |
(1..(self.size/s)).each{|i| yield self[((s)*(i-1))...((s)*i)]} and yield self[((self.size/s)*s)...self.size] | |
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
ebay_data = Scrubyt::Extractor.define do | |
fetch 'http://www.ebay.com/' | |
fill_textfield 'satitle', 'ipod' | |
submit | |
click_link 'Apple iPod' | |
record do | |
item_name 'APPLE NEW IPOD MINI 6GB MP3 PLAYER SILVER' | |
price '$71.99' |
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 after_save | |
unless @skip_callbacks | |
import_products_by_id(self.product_ids_for_import) if should_import_products? | |
import_keywords(keywords_for_import) if should_import_keywords? | |
import_product_ads_by_id(ad_ids_for_import) if should_import_ads? | |
campaign_products_to_product_ids_delimited if should_update_product_ids_delimited? | |
campaign_keywords_to_keywords_delimited if should_update_keywords_delimited? | |
campaign_ads_to_ad_ids_delimited if should_update_ad_ids_delimited? | |
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
require 'rubygems' | |
require 'httparty' | |
class GoogleSearch | |
include HTTParty | |
format :json | |
base_uri 'http://ajax.googleapis.com/ajax/services' | |
default_params :output => 'json', :v => "1.0" | |
def self.find(query) |
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
#!/usr/bin/env ruby | |
# | |
# usage: script/server_restarter | |
# | |
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+ | |
# is so fast when completely reloading the server, I wrote this script to listen to the | |
# given directories, and kill/restart the server when any file is changed. | |
# | |
# It's quick, simple, and it reliably reloads your application when changes are made. | |
# |
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
<iframe src="http://www.designerpages.com/collections/yanko-design/widget" style="border:0; overflow: hidden; height: 620px" border="0"></iframe> |
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
# What Does Harvest Do? | |
# Connects to a DataSource | |
# Downloads a Set of Data | |
# Normalizes Format | |
# Stores it in Sharded Harvest DB -> Silos | |
# Possibly removes data? | |
# What Does Processor Do? |
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
# What Does Harvest Do? | |
# Connects to a DataSource | |
# Downloads a Set of Data | |
# Normalizes Format | |
# Stores it in Sharded Harvest DB -> Silos | |
# Possibly removes data? | |
# What Does Processor Do? |
OlderNewer