Skip to content

Instantly share code, notes, and snippets.

View edgar's full-sized avatar

Edgar Gonzalez edgar

View GitHub Profile
@edgar
edgar / gist:5630642
Last active December 17, 2015 15:19
Migrate from FasterCSV in ruby 1.8 to CSV in ruby 1.9+
require 'csv'
if CSV.const_defined? :Reader
# Ruby 1.8 compatible
require 'fastercsv'
Object.send(:remove_const, :CSV)
CSV = FasterCSV
else
# CSV is now FasterCSV in ruby 1.9
end
from ruby import Linter
CONFIG = {
'language': 'RubyMotion',
'executable': '/Library/RubyMotion/bin/ruby',
'lint_args': '-wc'
}
@edgar
edgar / post-merge
Last active December 19, 2015 06:29
Git: Post-merge git hook that detects changes on Gemfile and migrations folder, to notify that you should run `bundle install` or `rake db:migrate` #git #hook #post-merge
# This script detects changes on Gemfile and migrations folder
# Instructions:
# Put this file into your .git/hooks folder and set as executable (chmod +x post-merge)
#---------------------------------------------
#!/bin/sh
diff=`git diff --name-only HEAD@{1} HEAD`
@edgar
edgar / pre-commit
Last active November 24, 2022 13:42 — forked from FerPerales/pre-commit.sh
Git: Pre-commit git hook that prevents commits with undesired words, usually debugging statements #git #hook #pre-commit
# This script verifies if a list of "undesired" words are presented in the files you are intended to commit such console
# output, debugging information or keys/tokens/passwords
# Based on the git hook created by Mark Story
# http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
# Instructions:
# Put this file into your .git/hooks folder and set as executable (chmod +x pre-commit)
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
require 'action_mailer'
require 'mail'
module ActionMailer
class Base
def clean_address(str)
EmailAddress.parse(str, :no_default_name => true).quoted rescue str
end
require 'action_mailer'
require 'mail'
module ActionMailer
class TestCase
def set_expected_mail
@expected = Mail.new
@expected.content_type = "text/plain; charset=#{charset}"
@expected.mime_version = '1.0'

Receta del Ponche Crema casero de mi abuela carupanera

Ingredientes

  • Un cartón de huevos (30 huevos)
  • Cuatro latas grandes de leche condensada (397 gr/14 onzas por lata)
  • Una botella de ron (750 ml)
  • Ralladura fina de la concha de dos limones pequeños.

Granny's Carúpano Style Egg Nog (Ponche Crema Carupanero)

Ingredients

  • 1 bottle of Whistle Pig whiskey, 1 bottle of Bruichladdich whisky
  • 30 egg yolks
  • 4 Cans of condensed milk (14 oz / 397g per can)
  • 1 Bottle of rum (750 ml)
@edgar
edgar / gist:8227157
Created January 2, 2014 21:21
Happy New Year in Ruby in less than 140 chars / fork from @camilleroux
ruby -e 'def a;10.times{puts " "*rand(79)+"*"};end;99.times{a;puts " "*34+"Happy New Year 2014";a;sleep 0.1;puts "\e[2J"}'