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
| git branch --merged | grep -v \* | xargs git branch -D |
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
| ActiveRecord::Base.logger = Logger.new(STDOUT) |
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
| 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 |
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
| # 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) |
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
| 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 |
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
| # Gem: https://github.com/SamSaffron/memory_profiler | |
| ##### Benchmark vendo memória de um módulo | |
| require "memory_profiler" | |
| MemoryProfiler.start | |
| module Teste | |
| extend self |
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
| 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 | |
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
| package main | |
| import "fmt" | |
| // Product structures to be filtered | |
| type Color int | |
| const ( | |
| red Color = iota | |
| green |
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
| package main | |
| import "fmt" | |
| // Product attributes to be filtered | |
| type Color int | |
| const ( | |
| red Color = iota | |
| green |
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
| require "csv" | |
| current = 0 | |
| read_to_array = CSV.read("all.csv", :headers => true) | |
| unique_user_ids = read_to_array.uniq { |u| u["user_id"] } | |
| unique_user_ids.each_slice(10000) do |rows| | |
| CSV.open("slice-#{current}.csv", "w") do |csv| | |
| rows.each do |row| |