Skip to content

Instantly share code, notes, and snippets.

View mhfs's full-sized avatar

Marcelo Silveira mhfs

View GitHub Profile
@mhfs
mhfs / gist:726872
Created December 3, 2010 11:53
VIM Strip Trailing Whitespaces
" Strip trailing whitespace
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
root@server:~# export CMDTEST='su cpfcnpj_mhfs_com_br -c "/usr/local/bin/unicorn -D -E production -c config/unicorn.rb"'
root@server:~# echo $CMDTEST
su cpfcnpj_mhfs_com_br -c "/usr/local/bin/unicorn -D -E production -c config/unicorn.rb"
root@server:~# $CMDTEST
su: invalid option -- 'D'
U
➜ s6-e1 % rails s
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/dependency.rb:52:in `initialize': Valid types are [:development, :runtime], not nil (ArgumentError)
from /Users/mhfs/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/resolver.rb:359:in `new'
from /Users/mhfs/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/resolver.rb:359:in `search'
from /Users/mhfs/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/resolver.rb:354:in `gems_size'
from /Users/mhfs/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/resolver.rb:179:in `resolve'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/source_index.rb:95:in `sort_by'
from /Users/mhfs/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/resolver.rb:175:in `each'
from /Users/mhfs/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/resolver.rb:175:in `sort_by'
from /Users/mhfs/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/resolv
@mhfs
mhfs / ubuntu10.04-ruby192.erb
Created August 15, 2011 21:14 — forked from czottmann/ubuntu10.04-ruby192.erb
Ubuntu 10.04 + Ruby 1.9.2p180 chef bootstrap file
bash -c '
if [ ! -f /usr/local/bin/chef-client ]; then
apt-get update
apt-get -y upgrade
apt-get install -y build-essential wget zlib1g-dev libssl-dev libffi-dev
cd /usr/src
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.bz2
tar xjf ruby-1.9.2-p180.tar.bz2
cd ruby-1.9.2-p180
./configure
@mhfs
mhfs / private.rb
Created October 5, 2011 17:53 — forked from joefiorini/private.rb
Indent methods under private?
# 1
class Blah
private
def method1
end
def method2
@mhfs
mhfs / gist:1511293
Created December 22, 2011 18:21
Postgres conditional unique index
create table unique_test (
number integer not null,
active boolean not null
)
create unique index unique_test_index on unique_test(number, boolean) where active;
insert into unique_test values (1, true);
insert into unique_test values (1, true);
-- ERROR: duplicate key value violates unique constraint "unique_test_index"
@mhfs
mhfs / caveatPatchor.js
Created October 3, 2012 19:18 — forked from protocool/caveatPatchor.js
Sample caveatPatchor.js file for use in Propane 1.1.2 and above
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.

This works:

App.Router.map(function(match) {
  match('/').to('index');
  match('/about').to('about');
  match('/contributor/:contributor_id').to('contributor');
});
@mhfs
mhfs / README.md
Created March 28, 2014 18:02 — forked from jm3/ d3 drift JS
@mhfs
mhfs / keybase.md
Last active August 29, 2015 14:03

Keybase proof

I hereby claim:

  • I am mhfs on github.
  • I am mhfs (https://keybase.io/mhfs) on keybase.
  • I have a public key whose fingerprint is 6F4B 7528 9C6B D712 7562 5153 D63A B713 961C 0AB5

To claim this, I am signing this object: