Skip to content

Instantly share code, notes, and snippets.

View wellavelino's full-sized avatar
🎧
Focusing

Wellington Avelino dos Santos wellavelino

🎧
Focusing
View GitHub Profile
@wellavelino
wellavelino / helper.rb
Created June 19, 2017 21:26
Simple module to generate a lot of test mock
module Helpers
def generate_cep
cep = rand(01000000...99990000)
generate_cep if cep.size < 8
cep
end
def generate_password
(0...8).map { ([65, 97].sample + rand(26)).chr }.push(rand(99)).join
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
@wellavelino
wellavelino / nokogiri_example.rb
Created September 26, 2017 20:37
nokogiri_example.rb
def expirate_code
sms_code = []
page = Nokogiri::HTML(open(CHANNEL_MANAGER,
http_basic_authentication:
[CREDENTIALS[:channel_manager][:login],
CREDENTIALS[:channel_manager][:password]]))
page.search('pre').each do |sms|
sms_code << sms.to_s.tr('<pre>', '')
@wellavelino
wellavelino / appium_calabash_commands.md
Created November 8, 2017 13:11
commands to inspect elements

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

@wellavelino
wellavelino / appium_install.md
Last active November 8, 2017 13:12
Appium install

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

@wellavelino
wellavelino / fix_instalation_imagemagik.rb
Created November 12, 2017 21:13
imagemagik fix instalation
brew install pkg-config
brew uninstall imagemagick
brew install imagemagick@6
brew link imagemagick@6 --force
@wellavelino
wellavelino / compare.rb
Last active November 22, 2017 19:06 — forked from mashhoodr/compare.rb
Comparing images in cucumber - calabash
require 'oily_png'
require 'open-uri'
include ChunkyPNG::Color
def starts_with(item, prefix)
prefix = prefix.to_s
item[0, prefix.length] == prefix
end
# compares two images on disk, returns the % difference
@wellavelino
wellavelino / start_emulator.sh
Last active November 23, 2017 19:40
workaround to fix start emualator on command line
#!/bin/bash
# change the folder to /tools
cd $(dirname $(which emulator)) && ./emulator -avd Droid22 > /dev/null &
cd
@wellavelino
wellavelino / lint.rb
Last active November 28, 2017 17:15
Simple output from lint class
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_.
15:19 $ rubocop lint.rb -f offenses -f clang
--
0 Total