Skip to content

Instantly share code, notes, and snippets.

require 'test_helper'
class RubocopTest < ActiveSupport::TestCase
describe 'when run over the app' do
it 'has a clean run' do
cli = RuboCop::CLI.new
result = cli.run(%w(--rails))
value(result).must_equal 0
end
end
FROM ruby:2.2.0
RUN apt-get update -qq && apt-get install -y build-essential nodejs npm nodejs-legacy vim
RUN npm install -g phantomjs
WORKDIR /tmp
ADD Gemfile Gemfile
ADD Gemfile.lock Gemfile.lock
RUN bundle install
OFFER_TYPES =
{
co: OFFER_TYPE_COLOMBIA,
mx: OFFER_TYPE_COLOMBIA
}
DEFAULT_TYPE = :mx
def self.trading_account_offer_type(user)
country = I18n.locale || user.pais.codigo_iso.to_sym || DEFAULT_TYPE
OFFER_TYPES[country]
class SimplePasswordGenerator
WORDS = %w(perro gato hormiga sapo lagarto caracol melocoton hocico canguro)
def self.generate(min_size = 10, max_size = nil)
pass = sample_w_number
pass += sample_w_number while pass.size < min_size
pass.slice!(0, max_size) if max_size
pass
end
alias abundle="azk shell -c bundle"
arake() { cmd="bundle exec rake $@"; azk shell -c $cmd; }
arails() { cmd="bundle exec rails $@"; azk shell -c $cmd; }
alias grubocop="git ls-files -m |xargs rubocop"
= render 'web/facebook_connect'
%code
= IO.readlines('app/views/web/_facebook_connect.html.haml').join
class PrimeNumberGenerator
def initialize
@list = []
end
def next
prime = next_prime
@list.push prime
prime
end
************************************************************************
Imagina que estamos implementando una tienda online, que vende solo 3 productos:
Codigo | Nombre | Precio
_______________________________
AM | Agua mineral | 3.11€
AC | Aceite | 5.00€
CA | Cafe | 11.23€