Skip to content

Instantly share code, notes, and snippets.

$:.unshift(File.dirname(__FILE__))
require 'spec_helper'
module BowlongGameMacro
class BowlongGamePlayer
def initialize
@game = Game.new
end
def roll_spare
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>{Title}{block:PostTitle} / {PostTitle}{/block:PostTitle}</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="{RSS}"/>
<link rel="Shortcut Icon" type="image/png" href="{Favicon}" />
{block:Description}<meta name="description" content="{MetaDescription}" />{/block:Description}
class Array
def maps(*methods)
methods = [methods].flatten
self.map do |node|
methods.inject(node) {|result, method| method.call(result) }
end
end
end
twice = lambda {|node| node * 2 }
ruby -e 'puts $stdin.read.gsub(/method\s+([\w"]*),\s+([\w"]*)/){ "assert #{$2}, #{$1}" }'
ruby -e 'puts $stdin.read.gsub(/method\s+([a-zA-Z"]*),\s+([a-z"]*)/){ "assert #{$2}, #{$1}" }'
# use escapse squence
setopt prompt_subst
# prompt
local DEFAULT=$'%{\e[01;m%}'
local PURPLE=$'%{\e[01;35m%}'
local CYAN=$'%{\e[04;36m%}'
if [ $TERM = "dumb" ]; then
PROMPT="> "
escape ^z^t
autodetach on
defscrollback 10000
shell -$SHELL
shelltitle "$ |zsh"
startup_message off
bind s # disable keyboard lock
@haru01
haru01 / hgcofig
Created September 30, 2010 06:03
# Generated by tortoisehg-config
[ui]
editor="C:\Program Files\Vim\vim72\gvim.exe" -c ":set fileencoding=cp932"
ignore=c:\home\hgignore.ini
[extensions]
hgext.win32text=
hgext.win32mbcs=
hgext.extdiff =
rebase =
# -*- encoding: UTF-8 -*-
describe "Money" do
it "3000.yen で Moneyオブジェクトが生成できること" do
3000.yen.should == Money.create(3000, :yen)
end
describe "比較演算" do
it " == できること " do
(1000.yen == 1000.yen).should be_true
(1000.yen == 1000.dollar).should be_false
@haru01
haru01 / money_spec.rb
Created February 24, 2011 13:21
moneyパターンの素振り(未完)
# -*- encoding: UTF-8 -*-
describe "Money" do
it "3000.yen で Moneyオブジェクトが生成できること" do
3000.yen.should == Money.create(3000, :yen)
end
describe "比較演算" do
it " == できること " do
(1000.yen == 1000.yen).should be_true
(1000.yen == 1000.dollar).should be_false