Skip to content

Instantly share code, notes, and snippets.

View carlosbrb's full-sized avatar

Carlos Barbiero carlosbrb

View GitHub Profile
@carlosbrb
carlosbrb / lets_challenge.rb
Created March 14, 2018 01:49
Solves the letsrevolutionizetesting.com challenge
#!/usr/bin/env ruby
require 'json'
require 'net/http'
result = nil
url = URI('https://letsrevolutionizetesting.com/challenge.json')
while result == nil
response = Net::HTTP.get_response(url)
challenge = JSON.parse(response.body)
if challenge.has_key?("follow")
@carlosbrb
carlosbrb / flatten_challenge.rb
Last active February 14, 2018 21:56
array_flatten
# Run this code executing in terminal:
# ruby flatten_challenge.rb
# or run in jdoodle: https://www.jdoodle.com/a/mSu
require 'minitest/autorun'
class Array
def flat_me
each_with_object([]) do |element, flattened|
flattened.push *(element.is_a?(Array) ? element.flat_me : element)
es:
errors:
messages:
expired: "ha expirado, por favor pide una nueva"
not_found: "no encontrado"
already_confirmed: "ya fue confirmada. Intenta ingresar."
not_locked: "no ha sido bloqueada"
not_saved:
one: "Ha habido 1 error:"
other: "Han habido %{count} errores:"
@carlosbrb
carlosbrb / gist:1271352
Created October 7, 2011 21:06
Simple Helper that create a link with a image before text. Same options that link_to. Put in application_helper.rb
def link_icon_to(image, text, url, options = {})
link_to image_tag(image) + " " + text, url, options
end