Skip to content

Instantly share code, notes, and snippets.

Ezequiel Delpero edelpero

Block or report user

Report or block edelpero

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@edelpero
edelpero / method_performance_comparison.rb
Created Apr 15, 2015
Compares method execution performance
View method_performance_comparison.rb
require 'benchmark/ips'
class A
def sum
1 + 1
end
end
class B
def sum
@edelpero
edelpero / cleaning_hash.md
Last active Aug 29, 2015
How to Remove Empty Elements and Empty Strings from a Hash and it's Child Elements
View cleaning_hash.md

How to Remove Empty Elements and Empty Strings from a Hash and it's Child Elements

This class will:

  • Convert all keys of the given hash into symbols.
  • Remove nil elements, empty strings, empty hashes and empty arrays, from the hash itself and it's child elements.
class HashSanitizer
@edelpero
edelpero / heroku_rails_phantomjs.md
Last active Jun 25, 2019
Heroku, Ruby on Rails and PhantomJS
View heroku_rails_phantomjs.md

#Heroku, Ruby on Rails and PhantomJS

In this post, I’m going to show you how to modify an existing Ruby on Rails app running on Heroku’s Cedar stack to use PhantomJS for screen scraping. If you’ve never heard of PhantomJS, it’s a command-line WebKit-based browser (that supports JavaScript, cookies, etc.).

Let’s get started. This is a high-level overview of the required steps:

  • Modify your app to use multiple Heroku buildpacks.
  • Extend your app to use both the Ruby as well as the PhantomJS buildpacks.
  • Confirm that everything worked.
@edelpero
edelpero / erb_to_haml.md
Last active Aug 29, 2015
Convert all ERB templates to HAML
View erb_to_haml.md

###1. Prerequisites:

You must have the following gems installed:

  • haml (or haml-rails)
  • hpricot
  • ruby_parser

###2. Create new HAML files

Test the changes: (no files created)

@edelpero
edelpero / gist:4240670
Created Dec 8, 2012 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts
View gist:4240670

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
You can’t perform that action at this time.