Skip to content

Instantly share code, notes, and snippets.

View eitoball's full-sized avatar
🏠
Working from home

Eito Katagiri eitoball

🏠
Working from home
View GitHub Profile
@eitoball
eitoball / codeiq_q469.rb
Last active December 25, 2015 18:29
CodeIQ×はてな エンジニア夏祭り2013 和田 卓人さんからのテスト駆動開発の問題(https://codeiq.jp/ace/wada_takuto/q469
class Greeter
def initialize(time_proc = -> { Time.now.strftime("%H:%M:%S") })
@time_proc = time_proc
end
def greet
time = @time_proc.call
if '05:00:00' <= time && time < '12:00:00'
'おはようございます'
elsif '12:00:00' <= time && time < '18:00:00'
context '納品書から' do
context '請求書を変換する場合' do
before do
@user = FactoryGirl.create(:user) do |u|
u.sender.bank_accounts.create(detail: 'Foo Bank')
end
end
it '請求元の銀行口座の情報をコピーする' do
invoice = described_class.from(@user.delivery_slips.first).to(:invoice)
@eitoball
eitoball / gdb.txt
Created December 30, 2012 05:27
For Ruby "Bug #7629 Segmentation fault" (https://bugs.ruby-lang.org/issues/7629)
$ gdb $HOME/.rbenv/versions/1.9.3-debug/bin/ruby /cores/core.65588
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug 5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done
Reading symbols for shared libraries . done
@eitoball
eitoball / introducting_rr.ja.txt
Created March 15, 2010 12:57
この文書は、rr の introducting_rr.txt (バージョン0.10.10時点)を日本語訳した文書です。
**RRの紹介**
ダブル Ruby の省略である RR という名前の新しいテストダブルフレームワークを紹介できてうれしく思います。
テストダブルは、[ダブルの説明]です。テストダブルについての詳細を http://xunitpatterns.com/Test%20Double.html で読むことができます。
RR は次の構成をサポートしています:
* Mock
* Stub
* instance_of
* Probe
@eitoball
eitoball / README.ja.rdoc
Created March 12, 2010 13:14
この文書はrr バージョン0.10.10時点のREADME.rdocを日本語に訳した文書です。This is Japanese-translation of README.rdoc of rr as of version 0.10.10.

RR (Double Ruby、ダブルRuby)は、豊富なダブル化技術と簡潔な文法を備えたテストダブルフレームワークです。

詳細な情報

メーリングリスト

  • double-ruby-users@rubyforge.org

  • double-ruby-devel@rubyforge.org

ウェブサイト

@eitoball
eitoball / index.html
Created December 30, 2009 15:30
この文書はSWFUploadの文書(バージョン2.2.0.1)を訳したものです。元の文書は、http://demo.swfupload.org/Documentation/ より閲覧することができます。この文書は私訳であり、公式文書ではありません。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>SWFUpload v2 文書</title>
</head>
<style type="text/css">
h1 /* Title */ {
}
@eitoball
eitoball / Authlogic.v.2.1.3.README.ja.rdoc
Created November 20, 2009 17:59
この文書はAuthlogic バージョン2.1.3時点のREADME.rdocを日本語に訳した文書です。This is Japanese-translation of README.rdoc of Authlogic as of version 2.1.3.

Authlogic

Authlogicは、簡潔で柔軟なRubyで記述された認証ソリューションです。

コードで例示して説明した方がいいでしょう…

Authlogicでは新しい型のモデルを提供しています。他のモデルのようにいくつでもどんな名前で必要なだけ作成することができます。この例では、クラス名から分かるようにUserモデルを使って認証を行おうとしています。

class UserSession < Authlogic::Session::Base
  # ここでは以下のように設定項目を記述します: