Skip to content

Instantly share code, notes, and snippets.

Avatar

Eustáquio Rangel taq

View GitHub Profile
View gist:10663010
ack.vim
bufexplorer
camelcasemotion
csv.vim
ctrlp.vim
emmet-vim
L9
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
@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
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:

View class_instance_variable.rb
class Test
class << self
attr_accessor :count
end
@count = 0
def initialize
self.class.count += 1
end
end
View find_by_sample.rb
class ActiveRecord::Base
def self.find_by_sample(sample)
columns = self.columns.reject {|column| %w(id created_at updated_at).include?(column.name) }
cond_str, cond_val = [], []
columns.each do |column|
value = sample.send(column.name)
next if value.nil?
cond_str << "#{column.name}=?"
cond_val << value
end
View html5.rb
module ActionView
module Helpers
module FormHelper
def email_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("email", options)
end
def url_field(object_name, method, options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("url", options)
end
def search_field(object_name, method, options = {})
View rvm-version.bash
__rvm_ps1 () {
if [ ! -f ~/.rvm/bin/rvm-prompt ]; then
exit 0
fi
RVM_VERSION=$(~/.rvm/bin/rvm-prompt)
FMT="%s"
if ([ -f "$(pwd)/Rakefile" ] ||
[ "$(find . -maxdepth 1 -name '*.rb' | head -n1)" != "" ]) &&
[ ! -z "$RVM_VERSION" ]; then
if [ -n "$1" ]; then
View gist:1371466
$ rvm install 1.9.2 --trace &> /tmp/rvm.log
1.9.2 --trace
rvm 1.9.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
+ /scripts/cli : __rvm_parse_args() 693 > [[ -n '' ]]
+ /scripts/cli : __rvm_parse_args() 694 > export 'PS4=+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ /scripts/cli : __rvm_parse_args() 694 > PS4='+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ /scripts/cli : __rvm_parse_args() 722 > [[ -z install ]]
+ /scripts/cli : __rvm_parse_args() 724 > [[ 0 -eq 1 ]]
@taq
taq / gist:1759632
Created Feb 7, 2012
Apple’s great GPL purge
View gist:1759632
From http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/, with access forbidden right now:
Apple obligingly allows you to browse and download the open source software they use in OS X. Since they have listings for each version of OS X, I decided to take a look at how much software they were using that was only available under the GNU public license. The results are illuminating:
10.5: 47 GPL-licensed packages.
10.6: 44 GPL-licensed packages.
10.7: 29 GPL-licensed packages.
This clearly supports the idea that Apple is aggressively trying to remove all GPL-licensed software from OS X. While the removal of Samba and GCC got some attention, the numbers show that there’s a more general purging going on.