Skip to content

Instantly share code, notes, and snippets.

View edelpero's full-sized avatar

Ezequiel Delpero edelpero

  • Tucuman, Argentina
View GitHub Profile
@edelpero
edelpero / method_performance_comparison.rb
Created April 15, 2015 16:16
Compares method execution performance
require 'benchmark/ips'
class A
def sum
1 + 1
end
end
class B
def sum
@edelpero
edelpero / cleaning_hash.md
Last active August 29, 2015 14:19
How to Remove Empty Elements and Empty Strings from a Hash and it's Child Elements

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 May 10, 2021 08:31
Heroku, Ruby on Rails and PhantomJS

#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 August 29, 2015 13:56
Convert all ERB templates to HAML

###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 December 8, 2012 15:07 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

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