Skip to content

Instantly share code, notes, and snippets.

View lflucasferreira's full-sized avatar
🎈
Don't you want it?

Lucas Ferreira lflucasferreira

🎈
Don't you want it?
View GitHub Profile
[alias]
ci = commit
co = checkout
cm = checkout master
cb = checkout -b
st = status -sb
sf = show --name-only
lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
incoming = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' ..@{u})
outgoing = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' @{u}..)
NIVEIS = Hash.new(Candidato::Desconhecido).merge(
junior: Candidato::Junior,
pleno: Candidato::Pleno,
senior: Candidato::Senior
)
candidato = NIVEIS[nivel].new(nome, telefone)
# OU...
NIVEIS = Hash.new(
klass = case nivel
when 'junior'
Candidato::Junior
when 'pleno'
Candidato::Pleno
when 'senior'
Candidato::Senior
else
Candidato::Desconhecido
end
case nivel
when 'junior'
candidato = Candidato::Junior.new(nome, telefone)
when 'pleno'
candidato = Candidato::Pleno.new(nome, telefone)
when 'senior'
candidato = Candidato::Senior.new(nome, telefone)
else
candidato = Candidato::Desconhecido.new(nome, telefone)
end
@lflucasferreira
lflucasferreira / case-hash-statements.rb
Last active June 8, 2020 02:25
Refatorando switch case com Hashes
# Exemplo 1: sem Hash
def comer(fruta)
case fruta
when 'b'
'Banana'
when 'c'
'Coco'
when 'm'
'Maçã'
var template = `
<table>
<tr>
<th>Job title</th>
<th>Location</th>
<th>Company</th>
</tr>
{{#each response}}
<tr>
@lflucasferreira
lflucasferreira / README
Created January 13, 2020 02:13 — forked from jasoncodes/README
Remote Chrome browser for Capybara
On the shared machine:
Download http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.33.0.jar&can=2&q=
$ brew install chromedriver
$ java -jar selenium-server-standalone-2.33.0.jar
On the local machine:
Set `CHROME_HOSTNAME` in your `.env`, `.rbenv_vars`, or per run.
# frozen_string_literal: true
def tarefa(hash = {})
browser = hash[:browser] ||= '-p chrome'
mode = hash[:mode] ||= '-p default'
desc "Executa os testes no #{hash[:task].capitalize} no modo #{hash[:env]}"
task hash[:task].to_sym, [:tags] do |_t, args|
Rake::Task['cucumber:command'].invoke(browser, mode, args.tags)
end
@lflucasferreira
lflucasferreira / qaops.md
Last active December 21, 2019 01:51
Pré-requisitos para o curso QAOps
@lflucasferreira
lflucasferreira / intro.md
Last active November 16, 2020 19:22 — forked from derhuerst/intro.md
Installing Git on Linux, Mac OS X and Windows