Skip to content

Instantly share code, notes, and snippets.

View Tassandar's full-sized avatar

Tassandar Tassandar

  • Industrial Bank
  • Shanghai
View GitHub Profile
#!/usr/bin/ruby
require 'rubygems'
require 'rubygems/commands/fetch_command'
class Gem::Commands::FetchCommand
def add_version_option_with_fetch_depends
add_version_option_without_fetch_depends
add_option('-y', '--[no-]dependencies',
"Fetch dependent gems") do |value, options|
@Tassandar
Tassandar / gist:3805892
Created September 30, 2012 04:55
sample Nginx config file to proxy requests to a Thin backend.
# user and group to run as
user ez ez;
# number of nginx workers
worker_processes 6;
# pid of nginx master process
pid /var/run/nginx.pid;
# Number of worker connections. 1024 is a good default
@Tassandar
Tassandar / ruby
Created September 29, 2012 10:30
How to parse CSV data with Ruby
#Ruby alternatives for parsing CSV files
# Ruby String#split (slow)
# Ruby CSV (slow)
# FasterCSV (ok, recommended)
# ccsv (fast & recommended if you have control over CSV format)
# CSVScan (fast & recommended if you have control over CSV format)
# Excelsior (fast & recommended if you have control over CSV format)
#CSV library benchmarks can be found here and here