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
{ "_id" : { "$oid" : "4e711ac4d413190fcc0000c2" }, "popularids" : [], "listing_ids" : [], "email_optin" : true, "sms_age_verification" : null, "created_at" : { "$date" : 1316035268000 }, "sms_alert" : false, "updated_at" : { "$date" : 1316035268000 }, "categoryids" : [ 5118494, 5118936, 5118495, 5118487, 5118492, 5118924, 5118993, 5118498, 5118497, 5118521 ], "email_processed" : false, "mobile_number" : null, "email_alert" : true, "last_name" : null, "storeid" : 2395871, "email_age_verification" : true, "remind_time" : null, "sms_optin" : true, "brandids" : [ -2099999884, -2099997271, -2099998575 ], "email" : "test@test.com", "newsletter_signup" : true, "first_name" : null, "remind_timezone" : null, "sms_processed" : false } |
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
ree-1.8.7-2011.03 :001 > GeoIpBlock.count | |
=> 6055096 | |
ree-1.8.7-2011.03 :005 > GeoIpBlock.first.e.class.name | |
=> "Fixnum" | |
ree-1.8.7-2011.03 :006 > res = Benchmark.measure { puts GeoLocation.by_ip('74.220.125.3').location }; puts res | |
San Francisco, CA | |
0.000000 0.000000 0.000000 ( 0.003826) |
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 | |
require 'rubygems' | |
require 'typhoeus' | |
hydra = Typhoeus::Hydra.new(:max_concurrency => 1) | |
hydra.disable_memoization | |
typh_options = {:headers => {"Accept-Encoding" => "deflate, gzip"}, :method => :get, :verbose => false} | |
r1 = Typhoeus::Request.new("http://www.yahoo.com/", typh_options) |
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 a; nil; end; def b; 'wee'; end; | |
c = [:a,:b].map{|m| send(m)} |
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
# Module to allow us to query listings and get back a Plucky object so we can | |
# continue to form the query before firing it off to mongo. Include this in | |
# any model that has many :listings. This is to get around MongoMapper | |
# not allowing us to use methods on the association helper methods it adds to | |
# the classes. Billy Kimble 2011-05-01 | |
module ListingsFinder | |
FIELDSETS = { | |
'homepage' => ["id","title","description"] | |
} |
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 | |
# List all keys stored in memcache. | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
require 'net/telnet' | |
headings = %w(id expires bytes cache_key) | |
rows = [] |
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 'spec_helper' | |
#Ethon param test | |
describe Ethon::Easy::Params do | |
before do | |
@dataset = | |
[ | |
#basics | |
["http://a.com", {:foo => '1'}, "http://a.com?foo=1"], | |
["http://a.com", {:foo => 1}, "http://a.com?foo=1"], |
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 foo.js | |
(function($, _, Backbone){ | |
Backbone._ = _; | |
Backbone.$ = $; | |
}) | |
//= require bar.js | |
($.noConflict(), _.noConflict(), Backbone.noConflict()); | |
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/ruby | |
puts "hello" | |
require 'tempfile' | |
puts ARGV[1] | |
filename,lines,prefix = ARGV | |
unless filename && lines |
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/ruby | |
puts "hello" | |
require 'tempfile' | |
puts ARGV[1] | |
filename,lines,prefix = ARGV | |
unless filename && lines |
OlderNewer