Skip to content

Instantly share code, notes, and snippets.

# coding: utf-8
require 'rspec'
describe Array do
describe '初期化' do
describe '初期値を引数で渡した場合' do
let(:current) { Array.new(2,'hoge') }
context 'Array.new(2, "hoge")' do
it '配列の要素がhogeになっていること' do
@pochi
pochi / convert_excel_to_gist.rb
Last active December 16, 2015 01:29
Convert execl to gist
require 'spreadsheet'
require 'csv'
filename = 'excelsample'
file = File.expand_path(File.dirname(__FILE__) + "/" + filename + '.xls')
excel = Spreadsheet.open(file, 'rb')
CSV.open(filename + '.csv', 'wb') do |csv|
excel.worksheets.each do |sheet|
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
CONFIGURE_OPTS="--with-readline-dir=/usr/local --with-gcc=gcc" rbenv install 1.9.3-p385
source :rubygems
gem 'thin'
gem 'rake'
gem 'sinatra-flash', :require => 'sinatra/flash'
gem 'activerecord', '~>3.2.11', :require => 'active_record'
gem 'mysql2'
@pochi
pochi / gist:4536526
Created January 15, 2013 05:53
padrino コマンド tips
padrino g project somethingproject --renderer none --test cucumber rspec --orm activerecord
@pochi
pochi / inherited.rb
Created January 9, 2013 11:41
self.inherited(klass)のサンプル。継承されると親クラスのinheritedが呼ばれる。
class Dog
def self.inherited(klass)
puts klass.inspect
end
end
class Pochi < Dog
end
#=> "Pochi"
@pochi
pochi / at_exit.rb
Last active December 10, 2015 21:08
at_exitはプログラム終了時に呼ばれる
module Test
at_exit do
puts "program finished"
end
end
defutf8 on
defkanji utf-8
encoding utf-8 utf-8
defencoding utf-8
defscrollback 10240
escape ^j^j
vbell off
hardstatus alwayslastline "[%02c] %`%-w%{=b bw}%n %t%{-}%+w"
defutf8 on
defkanji utf-8
encoding utf-8 utf-8
defencoding utf-8
defscrollback 10240
escape ^j^j
vbell off
hardstatus alwayslastline "[%02c] %`%-w%{=b bw}%n %t%{-}%+w"