Skip to content

Instantly share code, notes, and snippets.

🎮
playing software development

André Luiz Leoni andreleoni

🎮
playing software development
Block or report user

Report or block andreleoni

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Cenários
Os cenários se repetem pra bundle. Com excessao que nao poderá receber o email 2x, e fazer 2 requests de cancelamento para os correios.
O job: verifica unidades suspensas com "shipments" até completar os 7 dias de envio de suas etiquetas.
- Executa o procedimento de bloqueio nos correios para cada um destes.
Cenário 1:
Sendo um Usuário que comprei um produto fora da setting
E Gerei etiqueta
E encaminhei o produto
@andreleoni
andreleoni / bench.rb
Last active Feb 8, 2019
Benchmark sobre uso de memória Ruby Module vs Class
View bench.rb
# Gem: https://github.com/SamSaffron/memory_profiler
##### Benchmark vendo memória de um módulo
require "memory_profiler"
MemoryProfiler.start
module Teste
extend self
@andreleoni
andreleoni / gist:3708cd58e730d72bc644515d17722de0
Created Jan 21, 2019
total of purchase ratings on the years
View gist:3708cd58e730d72bc644515d17722de0
SELECT COUNT(DISTINCT (CASE WHEN bundle_id IS NOT NULL THEN bundle_id END )) + COUNT(CASE WHEN bundle_id IS NULL THEN 1 END)
FROM purchase_ratings
WHERE created_at BETWEEN to_date('01/09/2018', 'DD/MM/YYYY') AND to_date('30/09/2018', 'DD/MM/YYYY')
Janeiro
39,688
Fevereiro
@andreleoni
andreleoni / complex_pt1.rb
Created Jan 5, 2019
medium post complex references
View complex_pt1.rb
# Cria o objeto
object = { a: 1, b: 2 }
=> {:a=>1, :b=>2}
# Cria a referência
reference = object
=> {:a=>1, :b=>2}
# Deleta o objeto da referência
reference.delete(:a)
View gist:0169c9782c14a119a7e93d7c993b383d
mkdir ~/.go
echo "GOPATH=$HOME/.go" >> ~/.bashrc
echo "export GOPATH" >> ~/.bashrc
echo "PATH=\$PATH:\$GOPATH/bin # Add GOPATH/bin to PATH for scripting" >> ~/.bashrc
source ~/.bashrc
View delete all local branches
git branch --merged | grep -v \* | xargs git branch -D
@andreleoni
andreleoni / gist:56e851348af5b2ed49c00c83fb5e10ba
Created Aug 7, 2018
create annotate with index and foreign keys
View gist:56e851348af5b2ed49c00c83fb5e10ba
annotate --show-indexes --exclude tests,fixtures,factories,serializers --show-foreign-keys
View gist:9cf876b7915d1fc98432a7e81ffe3931
2.5.1 :042 > MyClassWithSelfClass.my_function
Traceback (most recent call last):
2: from /Users/andreleoni/.rvm/rubies/ruby-2.5.1/bin/irb:11:in `<main>'
1: from (irb):42
NoMethodError (undefined method `my_function' for MyClassWithSelfClass:Class)
View modules
module WithSelfClass
class << self
def my_function
"Presenter"
end
end
end
class MyClassWithSelfClass
extend WithSelfClass
You can’t perform that action at this time.