Resumo do vídeo "Crie sua Oferta Irresistível" do Conrado Adolpho.
Cliente ➙ Oferta ➙ Produto
source 'https://rubygems.org' | |
gem 'mechanize' | |
gem 'pry' |
Resumo do vídeo "Crie sua Oferta Irresistível" do Conrado Adolpho.
Cliente ➙ Oferta ➙ Produto
%w(1 2).sort_by { |i| nil } | |
# => ["1", "2"] | |
# ... | |
%w(1 2 3 4 5 6).sort_by { |i| nil } | |
# => ["1", "2", "3", "4", "5", "6"] | |
### So far, so good... | |
### But look what happens when you have 7 or more elements: |
public extension Array { | |
public subscript(safe index: Int) -> Element? { | |
return self.indices ~= index ? self[index] : nil | |
} | |
} | |
// ... | |
let optionalResult = array[safe: 1] // returns nil instead of crashing |
(1..50).to_a.first # => 1 | |
(1..50).to_a.second # => 2 | |
(1..50).to_a.third # => 3 | |
(1..50).to_a.fourth # => 4 | |
(1..50).to_a.fifth # => 5 | |
(1..50).to_a.forty_two # => 42 |
#!/usr/bin/env ruby | |
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do |
# Navigating | |
visit '/projects' | |
visit post_comments_path(post) | |
# Clicking links and buttons | |
click_link 'id-of-link' | |
click_link 'Link Text' | |
click_button 'Save' | |
click 'Link Text' # Click either a link or a button | |
click 'Button Value' |
# (...) | |
Rails.boot! | |
# The code below allow to use Thin as the webserver | |
if $0 == 'script/server' | |
# commands/server.rb (#45) is not cooperative, so we patch Rack itself | |
require 'rack' | |
module Rack::Handler | |
class << self |
#!/usr/bin/env ruby | |
require 'fileutils' | |
def make_tests_specs(current_path) | |
current_path[:test_unit_directory].each do |file| | |
unless file == '.' or file == '..' | |
full_file = File.join(current_path[:test_unit_directory].path, file) | |
if File.directory?(full_file) |
#!/bin/bash | |
# Usage: after_merge branch_name | |
branch="$1" | |
git checkout master | |
git pull --rebase | |
git remote prune origin | |
git branch -d $branch |