Skip to content

Instantly share code, notes, and snippets.

Avatar

Eustáquio Rangel taq

View GitHub Profile
@taq
taq / classvar.rb
Created May 9, 2018
Ruby class variable
View classvar.rb
class Foo
class << self
attr_reader :ivar
end
@ivar = 'Hello!'
end
class Bar < Foo
@ivar = 'World'
end
@taq
taq / gist:1ef38725c39c041f59701f29a83c7fa3
Created Oct 11, 2016
Git alias to create a new remote branch based on the current branch
View gist:1ef38725c39c041f59701f29a83c7fa3
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 Nov 24, 2015
Minitest with before_all
View spreadsheet_test.rb
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 Jan 14, 2016
Minitest without before_all
View sṕreadsheet_test.rb
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
View 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 Feb 17, 2015
Ruby 2.2.0 circular reference problem
View circular.rb
class FooBar
def foo
"I'm in foo!"
end
def bar(foo = foo)
puts foo
end
end
@taq
taq / gist:ae0e323786a41cfc237c
Created Sep 17, 2014
Plugins do Vim que eu uso
View gist:ae0e323786a41cfc237c
ag.vim
bufexplorer
camelcasemotion
ctrlp.vim
emmet-vim
L9
limelight.vim
nerdcommenter
nerdtree
syntastic
@taq
taq / nginx
Created Apr 21, 2014
Nginx Ubuntu service
View nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
View gist:10663010
ack.vim
bufexplorer
camelcasemotion
csv.vim
ctrlp.vim
emmet-vim
L9
nerdcommenter
nerdtree
syntastic
@taq
taq / refine.rb
Created Dec 26, 2013
Ruby 2.1 refinements
View refine.rb
module TimeExtensions
refine Fixnum do
def min2sec; self * 60; end
end
end
class Minutes
using TimeExtensions
def self.to_sec(min)