Skip to content

Instantly share code, notes, and snippets.

View taq's full-sized avatar

Eustáquio Rangel taq

View GitHub Profile
@taq
taq / gist:1ef38725c39c041f59701f29a83c7fa3
Created October 11, 2016 22:28
Git alias to create a new remote branch based on the current branch
Just insert on .gitconfig:
nrb = "!f() { git push -u origin $(git rev-parse --abbrev-ref HEAD):$1; }; f"
And then, when on a local branch and want to push to a new remote branch called, say, 'test':
$ git nbr test
Total 0 (delta 0), reused 0 (delta 0)
To <your remote here>
* [new branch] work -> test
@taq
taq / classvar.rb
Created May 9, 2018 11:21
Ruby class variable
class Foo
class << self
attr_reader :ivar
end
@ivar = 'Hello!'
end
class Bar < Foo
@ivar = 'World'
end
@taq
taq / inquirer_bench.rb
Created March 13, 2023 23:06
Comparação com o ActiveSupport::StringInquirer
require 'active_support/string_inquirer'
require 'benchmark'
# classe
class ClientExternalData
# o método com o inquirer/method_missing
def identifier
ActiveSupport::StringInquirer.new('uuid')
end
@taq
taq / test.rb
Created December 21, 2023 19:04
Pull request example first file
class Test
end
@taq
taq / test.rb
Created December 21, 2023 19:08
Pull request example with constructor
class Test
def initialize
puts 'Inicializando um teste ...'
end
end
@taq
taq / 0001-Construtor.patch
Created December 21, 2023 19:16
Pull request patch file example
From f0af0ed80173a0a3ff0ed1316bdb09ba64b518f0 Mon Sep 17 00:00:00 2001
From: Eustaquio Rangel <taq@eustaquiorangel.com>
Date: Thu, 21 Dec 2023 16:12:23 -0300
Subject: [PATCH] Construtor
---
test.rb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/test.rb b/test.rb