Skip to content

Instantly share code, notes, and snippets.


Pedro Belo pedro

  • San Francisco, CA
  • @ped
View GitHub Profile
View fix_rack_multiparse_parsing.rb
# temporary monkey patch to apply patch described in:
module Rack
module Utils
module Multipart
def self.parse_multipart(env)
unless env['CONTENT_TYPE'] =~
View bundler-bundle-itself.diff
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 3314db0..16e6498 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -91,6 +91,8 @@ module Bundler
"Don't update the existing gem cache."
method_option "quiet", :type => :boolean, :banner =>
"Only output warnings and errors."
+ method_option "no-auto-update", :type => :boolean, :banner =>
+ "Do not bundle itself"
View gist:458283
A few people asked about my issue with Rails 3 so here's the summary:
* Overriding to_json doesn't work anymore - render :json => User.all
seems to be ignoring any options defined in there.
* So I google around, there's a great explanation behind that, cool.
Lets move on and define as_json...
* Only it doesn't work if you try to call super with :only, :except,
or any of those options. Rails kept rendering all attributes.
View gist:1124103
Hi Pedro,
Just a friendly reminder (since it's your first check due) that your rent payment was due on August 1st, and today is the last day to pay and not to get a late fee.
View retry_upto.rb
# Ruby's `retry` with steroids:
# - retry up to 5 times without waiting between them and retrying after any exception
# retry_upto(5) do ... end
# - retry up to 5 times, waiting 2 seconds between retries and retrying after any exception
# retry_upto(5, :wait => 2) do ... end
View gist:1288447

Sample PHP+Mongo app on Heroku

  1. Install any of the Mongo add-ons available at

  2. Vendor the Mongo driver with your application. You can download it here:

    Add it to a folder like "ext".

View faraday-skip-ssl-verification-hack.rb
module Faraday
class Adapter
class NetHttp
def ssl_verify_mode(ssl)
pedro / Gemfile
Last active Dec 18, 2015
Testing ActiveRecord performance
View Gemfile
source ""
gem "pg"
gem "sqlite3"
unless version = ENV["AR"]
abort("specify ActiveRecord version with AR. eg: AR=2 bundle install")
gem "activerecord", "~> #{version}", require: "active_record"

Hypermedia API design session

Proposed/ran by Andreas Schmidt, Nokia

Based off his design around the Nokia Places API


  • Picked JSON, no support for XML
  • Added ?accept=application/json to the URL in the browser for a raw response

One API to rule them all

An API can be split between:

  • Public
  • Private

Or maybe between consumers:

  • iOS/Android