Skip to content

Instantly share code, notes, and snippets.

@ainoya
ainoya / gist:4662509
Created January 29, 2013 07:38
Convert csv data to array of hash/yaml/json.etc.. in ruby
#!/usr/bin/env ruby
require 'csv'
require 'yaml'
require 'json'
csv =<<EOF
id,name,price
A1,apple,100
A2,grape,300
@ainoya
ainoya / gist:4662125
Last active December 11, 2015 21:28
Avoiding pry installation failure by installing rdoc gem before install it.
➜ ~ rbenv global 1.9.3-p286
➜ ~ rbenv rehash
➜ ~ gem install pry
Fetching: coderay-1.0.8.gem (100%)
Fetching: slop-3.4.3.gem (100%)
Fetching: method_source-0.8.1.gem (100%)
Fetching: pry-0.9.11.4.gem (100%)
Successfully installed coderay-1.0.8
Successfully installed slop-3.4.3
Successfully installed method_source-0.8.1
@ainoya
ainoya / pry
Created December 7, 2012 06:08
pryで返り値のダンプを抑制する ref: http://qiita.com/items/0aea440faa5d78630c9a
[73] pry(main)> (1..100).step(1).to_a.each{|n| warn n if n==100}
100
=> [1,
2,
3,
4,
5,
: #ダンプ出力があふれてpagerが立ち上がる
---------------------
[74] pry(main)> (1..100).step(1).to_a.each{|n| warn n if n==100};