This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ************************************************************************ | |
| 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€ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PrimeNumberGenerator | |
| def initialize | |
| @list = [] | |
| end | |
| def next | |
| prime = next_prime | |
| @list.push prime | |
| prime | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| = render 'web/facebook_connect' | |
| %code | |
| = IO.readlines('app/views/web/_facebook_connect.html.haml').join |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # encoding: UTF-8 | |
| # | |
| # LearnRubyByExample: | |
| # | |
| # Ruby is a highly expressive programming language. | |
| # Testing software is an expressive way to communicate how it works. | |
| # | |
| # In the middle of a night awake for allergy and insomnia, and some days after the 1st _why day, | |
| # I've tried to combine Ruby and testing to help teaching ruby with some goals in mind: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EquilibriumPoint | |
| ERROR_CODE = -1 | |
| def initialize(arr) | |
| @arr = arr | |
| end | |
| def get_point | |
| indexes_without_edges.each do |index| | |
| return index if equilibrium_point?(index) |
OlderNewer