Skip to content

Instantly share code, notes, and snippets.

View taq's full-sized avatar

Eustáquio Rangel taq

View GitHub Profile
@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
@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 / test.rb
Created December 21, 2023 19:04
Pull request example first file
class Test
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 / 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 / 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 / spreadsheet_test.rb
Created November 24, 2015 19:03
Minitest with before_all
require "minitest/autorun"
require "minitest/spec"
require "spreadsheet"
describe 'spreadsheet' do
def self.before_all
@doc ||= Spreadsheet.open "spreadsheet.xls"
end
before do
@taq
taq / sṕreadsheet_test.rb
Last active January 14, 2016 12:04
Minitest without before_all
require "minitest/autorun"
require "minitest/spec"
require "spreadsheet"
describe 'spreadsheet' do
before do
@doc ||= Spreadsheet.open "spreadsheet.xls"
puts "document object id: #{@doc.object_id}"
end
@taq
taq / keybase.md
Created May 27, 2015 10:27
keybase.md

Keybase proof

I hereby claim:

  • I am taq on github.
  • I am taq (https://keybase.io/taq) on keybase.
  • I have a public key whose fingerprint is 840B 7492 E475 8DB6 B5DE 81D0 6611 4C70 E7F6 C0C0

To claim this, I am signing this object:

@taq
taq / circular.rb
Created February 17, 2015 14:54
Ruby 2.2.0 circular reference problem
class FooBar
def foo
"I'm in foo!"
end
def bar(foo = foo)
puts foo
end
end