Skip to content

Instantly share code, notes, and snippets.


Wellington Avelino dos Santos wellavelino

View GitHub Profile
wellavelino / helper.rb
Created Jun 19, 2017
Simple module to generate a lot of test mock
View helper.rb
module Helpers
def generate_cep
cep = rand(01000000...99990000)
generate_cep if cep.size < 8
def generate_password
(0...8).map { ([65, 97].sample + rand(26)).chr }.push(rand(99)).join
View gist:2665872b70a01f1c2761b6841adac79c
while(list of unvisited URLs is not empty) {
take URL from list
fetch content
record whatever it is you want to about the content
if content is HTML {
parse out URLs from links
foreach URL {
if it matches your rules
and it's not already in either the visited or unvisited list
add it to the unvisited list
View nokogiri_example.rb
def expirate_code
sms_code = []
page = Nokogiri::HTML(open(CHANNEL_MANAGER,
CREDENTIALS[:channel_manager][:password]]))'pre').each do |sms|
sms_code <<'<pre>', '')

Appium commands

driver.rotate :landscape

driver.rotate :portrait

find_element(id:'title').text = retorna o texto do elemento

find_element(id:'title').name = retorna o texto do elemento


Configuração Appium (Ruby lib)

Atualizar versão do Ruby para 2.2++

rbenv install 'versão do ruby'

Instalar/Atualizar o node na máquina

View fix_instalation_imagemagik.rb
brew install pkg-config
brew uninstall imagemagick
brew install imagemagick@6
brew link imagemagick@6 --force
wellavelino / compare.rb
Last active Nov 22, 2017 — forked from mashhoodr/compare.rb
Comparing images in cucumber - calabash
View compare.rb
require 'oily_png'
require 'open-uri'
include ChunkyPNG::Color
def starts_with(item, prefix)
prefix = prefix.to_s
item[0, prefix.length] == prefix
# compares two images on disk, returns the % difference
wellavelino /
Last active Nov 23, 2017
workaround to fix start emualator on command line
# change the folder to /tools
cd $(dirname $(which emulator)) && ./emulator -avd Droid22 > /dev/null &
wellavelino / lint.rb
Last active Nov 28, 2017
Simple output from lint class
View lint.rb
lint.rb:1:1: W: Script file lint.rb doesn't have execute permission.
#!/usr/bin/env ruby
lint.rb:2:1: C: Missing top-level class documentation comment.
class Lint
lint.rb:3:1: C: Use 2 (not 0) spaces for indentation.
def get_even_numbers
lint.rb:3:5: C: Do not prefix reader method names with get_.
View refactor_lint.rb
15:19 $ rubocop lint.rb -f offenses -f clang
0 Total