Skip to content

Instantly share code, notes, and snippets.

View mgomes's full-sized avatar

Mauricio Gomes mgomes

View GitHub Profile
@mgomes
mgomes / raw_couchdb_find.rb
Created February 8, 2011 21:29
Uses Curl
def raw_find(view, key)
url = URI::parse(CouchPotato::Config.database_name)
if key.is_a?(String)
http_client = Curl::Easy.new("#{url}/_design/advocacy_polygon/_view/#{EscapeUtils.escape_url(view)}?key=%22#{EscapeUtils.escape_url(key.to_s)}%22&reduce=false&include_docs=true")
elsif key.is_a?(Integer)
http_client = Curl::Easy.new("#{url}/_design/advocacy_polygon/_view/#{EscapeUtils.escape_url(view)}?key=#{EscapeUtils.escape_url(key.to_s)}&reduce=false&include_docs=true")
elsif key.is_a?(Range)
http_client = Curl::Easy.new("#{url}/_design/advocacy_polygon/_view/#{EscapeUtils.escape_url(view)}?startkey=#{EscapeUtils.escape_url(key.begin)}&endkey=#{EscapeUtils.escape_url(key.end)}&reduce=false&include_docs=true")
else
raise SyntaxError
# Run these commands
# Uses Homebrew install of libxml2 with Snow Leopard version of libxslt
brew install libxml2
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.7/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.7/lib --with-xslt-lib=/usr/lib/libxslt.1.dylib
# Install Ruby 1.9.2 on OS 10.6
# Uses RVM and homebrew
# Install RVM (if you haven't already)
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
# Install homebrew (if you haven't already)
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"
# If you already had rvm installed (older versions only)