Skip to content

Instantly share code, notes, and snippets.

View thiagovsk's full-sized avatar
🏠
Working from home

Thiago Ribeiro thiagovsk

🏠
Working from home
View GitHub Profile
vim.diagnostic.config({
virtual_text = false
})
-- Show line diagnostics automatically in hover window
vim.o.updatetime = 250
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
require "active_support/concern"
module M
extend ActiveSupport::Concern
included do
has_many :things
scope :disabled, -> { where(disabled: true) }
after_commit :send_email
validates :email, length: { maximum: 255 }, email: true
module Formatter
def self.included base
base.extend ClassMethods
end
module ClassMethods
def class_method
"yahy"
end
end
@thiagovsk
thiagovsk / classes_2.rb
Last active March 16, 2022 21:33
using inheritance
class Formatter
def formatted_phone(phone)
phone.delete("^0-9")
end
end
class Payment < Formatter
def phone(phone)
formatted_phone(phone)
end
@thiagovsk
thiagovsk / classes.rb
Last active March 16, 2022 21:31
bad modules example
class Payment
def formatted_phone(phone)
phone.delete("^0-9")
end
end
class Contact
def formatted_phone(phone)
phone.gsub(/[^0-9]/, '')
end
@thiagovsk
thiagovsk / semantic-commit-messages.md
Created September 13, 2021 15:06 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@thiagovsk
thiagovsk / gist:a433919d09717e1f19a5b79e2e4e1601
Last active October 14, 2019 14:59
importante event sourcing
We couldn’t find that file to show.
@thiagovsk
thiagovsk / rails http status codes
Created February 4, 2019 12:23 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@thiagovsk
thiagovsk / Dockerfile
Created October 15, 2018 13:33
ruby 2.5 with jemalloc
ROM buildpack-deps:stretch
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
libffi-dev \
libgdbm3 \
libssl-dev \
libyaml-dev \
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2 in line 1.
CÛdigo do Produto Nome do Produto NCM CEST CFOP CSOSN COFINS PIS Origem Unidade PreÁo de Venda
900005253 #CART MASC 19081 CAFE 42023200 00.000.00 5102 101 4 4 2 - Importado UND R$ 34,62
900005219 #CART MASC 19081 PRETO 42023200 00.000.00 5102 101 4 4 2 - Importado UND R$ 34,62
900004953 #CART MASC 19089 CAFE 42023200 00.000.00 5102 101 4 4 2 - Importado UND R$ 64,12
900004919 #CART MASC 19089 PRETO 42023200 00.000.00 5102 101 4 4 2 - Importado UND R$ 64,12
901901553 #CARTEIRA PCOURO CAFE 42023200 00.000.00 5102 101 4 4 2 - Importado UND R$ 37,67
901906753 #CARTEIRA PCOURO CAFE 42023200 00.000.00 5102 101 4 4 2 - Importado UND R$ 50,09
901901519 #CARTEIRA PCOURO PRETO 42023200 00.000.00 5102 101 4 4 2 - Importado UND R$ 37,67
901906719 #CARTEIRA PCOURO PRETO 42023200 00.000.00 5102 101 4 4 2 - Importado UND R$ 50,09
226007001 &amp;BOLSA COURO XCBD60-070-01 42022100 00.000.00 5102 101 4 4 2 - Importado UND R$ 151,34