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 bash | |
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
# Versions | |
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` |
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
#Toda vez que uso o Module | |
module ModuleName | |
end | |
Estou sobreescrevendo(override- polimorfismo) a classe Module do Ruby | |
class module | |
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
Comando utils | |
docker stop -t 0 $(docker ps -q) ele para todos os container ao mesmo tempo em 0 segundos | |
docker container prune remove todos os containers que estão parados. | |
docker run -it -v "/workspace/projetos/docker:/var/www/" ubuntu ele cria um volume dar pasta do container ubuntu e linka na local docker | |
docker inspect id_imagem ele mostra um json na chave mounts ele mostra destinatio(container), source roda código local | |
docker system prune -a delete all images | |
docker run -d -p 8080:3000 -v "/workspace/projetos/docker/node:/var/www" -w "/var/www" node npm start | |
executa a imagem node sem travar a maquina(-d) na porta 3000 do container transferindo para a porta 8080 local salvando arquivo no vloume do container /var/www sendo transferindo para local docker ou vice-verça startando no work director(-w) /var/www executando o comando node start | |
docker run -p 8080:3000 -v "$( |
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
################################Definir Classe em runtime################################ | |
classe = "danilo" | |
classe = classe.capitalize | |
# or alterando a referencia direta | |
classe.capitalize! | |
#criar classe dinamicamente | |
eval("class #{classe} end") | |
#constant_get retorna o objeto | |
classe = Object.const_get(classe) | |
puts classe |
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
############################Eval################################### | |
a = "puts 1 + 2" | |
eval a | |
#ele executa a imprimindo 3 == metaprogamacao | |
############################Instance_eval para a instancia################################### | |
#ele consegue pegar metodos privados tambem |
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
#####################################lambda############################################# | |
# todos os loops usam lambdas | |
#lambda nao aceita mais parametros do que os definidos | |
#lambda retorno dentro do proprio lambda | |
l = lambda {|param| param * 5} | |
puts l.call(4) | |
l = lambda do |p1, p2| |
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
# inserir modulos dentro da estancia | |
module Validacoes | |
def validar_cpf | |
true | |
end | |
def validar_cnpj | |
false | |
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
def choose_air company | |
#faça algo | |
rescue Exception => e | |
raise "Ocorreu erro" | |
puts e.message | |
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
class Carro | |
def initialize(nome = "Modelo padrao") | |
@nome = nome | |
end | |
#metaprogramaçao, gera os gets e sets | |
attr_accessor :nome, :porta, :painel, :roda | |
attr_writer :pneu | |
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 Carro | |
#constructor | |
def initialize nome = "Modelo padrao" | |
@nome = nome | |
end | |
#set | |
def nome=(value) | |
@nome = value |