Skip to content

Instantly share code, notes, and snippets.

View mhfs's full-sized avatar

Marcelo Silveira mhfs

View GitHub Profile
@mhfs
mhfs / Gemfile
Last active August 29, 2015 14:15
check twitter username availability
# A sample Gemfile
source "https://rubygems.org"
ruby "2.1.2"
gem "httparty"
gem "pony"
@mhfs
mhfs / gist:12272814bf8a3145435a
Last active March 3, 2016 00:06
How to stream, uncompress and decode a CSV file straight from a remote URL.
package main
import (
"compress/gzip"
"encoding/csv"
"fmt"
"io"
"net/http"
"os"
)
@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:

@mhfs
mhfs / README.md
Created March 28, 2014 18:02 — forked from jm3/ d3 drift JS

This works:

App.Router.map(function(match) {
  match('/').to('index');
  match('/about').to('about');
  match('/contributor/:contributor_id').to('contributor');
});
@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.
@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 / 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 / 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
➜ 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