Public Gists by pauldix

Gravatar
Sat Nov 14 10:50:39 -0800 2009
1
2
3
/usr/local/lib/ruby/gems/1.9.1/gems/typhoeus-0.1.6/lib/typhoeus/multi.rb:20: [BUG] Segmentation fault
ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
 
Gravatar
Fri Oct 16 13:30:56 -0700 2009
1
2
3
require 'rubygems'
require 'typhoeus'
require 'yajl/json_gem'
Gravatar
Thu Oct 08 08:14:56 -0700 2009
1
2
3
# single json object cache miss (passenger)
ab -n 10000 -c 50 http://ec2-some-ip.compute-1.amazonaws.com/api/v1/comments/1/no_cache
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Gravatar
Sun Oct 04 10:52:30 -0700 2009

      
Gravatar
Sun Oct 04 10:52:19 -0700 2009

      
Gravatar
Thu Aug 27 12:34:56 -0700 2009
1
2
3
class User
  def initialize(attrs = {})
    # do stuff here
Gravatar
Thu Aug 27 11:31:34 -0700 2009
1
2
3
hydra = Typhoeus::Hydra.new(20) # number is the size of the easy object pool
 
user_request = User.find_request(1) # where 1 is the id of the user
Gravatar
Thu Aug 27 11:13:43 -0700 2009
1
2
3
    hydra = Typhoeus::Hydra.new(3)
 
    @responses = []
Gravatar
Fri Jun 19 08:11:01 -0700 2009
1
2
3
# this shows how to use the update functionality for a single feed with feedzirra
require 'rubygems'
require 'feedzirra'
Gravatar
Wed May 13 12:13:08 -0700 2009
1
2
3
require 'rubygems'
require 'json'
require 'typhoeus'
Gravatar
Thu May 07 15:37:44 -0700 2009
1
2
3
# This is a code example for the Ruby HTTP library Typhoeus
 
# here's an example for twitter search
Gravatar
Thu Mar 19 08:26:26 -0700 2009
1
2
3
# access an http basic feed. You can't do this in a bulk feed get. It has to be when getting only one.
Feedzirra::Feed.fetch_and_parse(some_url, :http_authentication => ["username", "password"])
 
Gravatar
Thu Mar 05 09:05:23 -0800 2009
1
2
3
calls = 10
@klass = Class.new do
  include HTTPMachine
Gravatar
Tue Mar 03 07:34:17 -0800 2009
1
2
3
# an idea for the interface to add common parsing elements across all feed
# entry types. Basically have them all inherit from FeedEntry and then
# open up the class.
Gravatar
Mon Feb 23 13:33:07 -0800 2009
1
2
3
HTTPMachine.service_access
  @pages = YahooBOSS.web_search("paul dix").get_pages
end
Gravatar
Mon Feb 23 13:29:06 -0800 2009
1
2
3
class YahooBOSS < HTTPMachine::Remote
  API_ID = "..."
  
Gravatar
Fri Feb 20 11:51:52 -0800 2009
1
2
3
# A code snippet that takes a hash and recursively converts it to an object
# that you call methods on instead of hash accessors. So
# h = {:foo => "bar}
Gravatar
Fri Feb 13 05:37:38 -0800 2009
1
2
3
# Let's say we have a feed entry object
entry = feed.entries.first
 
Gravatar
Mon Feb 02 19:39:38 -0800 2009
1
2
3
require 'feedzirra'
 
# fetching a single feed
Gravatar
Thu Jan 22 05:57:32 -0800 2009
1
2
3
class Entry
  include SAXMachine
  element :title