Skip to content

Instantly share code, notes, and snippets.

View cesarfigueroa's full-sized avatar

Cesar Figueroa cesarfigueroa

View GitHub Profile
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Recognized HTTParty parameters:
Class Foo
include HTTParty
http_proxy '<URL>', <PORT> # Allows setting http proxy information to be used
base_uri '<URL>' # Allows setting a base uri to be used for each request. Will normalize uri to include http, etc.
basic_auth '<USERNAME>', '<PASS>' # Allows setting basic authentication username and password.
digest_auth '<USERNAME>', '<PASS>' # Allows setting digest authentication username and password.
default_params <Default_Param_Hash> # Allows setting default parameters to be appended to each request. Great for api keys and such.
def transform_hash(original, options={}, &block)
original.inject({}){|result, (key,value)|
value = if (options[:deep] && Hash === value)
transform_hash(value, options, &block)
else
value
end
block.call(result,key,value)
result
}
require 'feedzirra'
# fetching a single feed
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing")
# feed and entries accessors
feed.title # => "Paul Dix Explains Nothing"
feed.url # => "http://www.pauldix.net"
feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing"
feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0"