Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
hello

Yutaka HARA yhara

:octocat:
hello
View GitHub Profile
@yhara
yhara / zipper.rb
Created Aug 7, 2008
Ruby implementation of Zipper (and its spec)
View zipper.rb
#
# Zipper has @left and @right.
# When a zipper represents [1, 2, 3, <cursor>, 4, 5],
# @left == [3, [2, [1, []]]], @right == [4, [5, []]]
# Note that @left is in reverse order.
#
class Zipper
include Enumerable
def self.make(*vals)
View kosoan_growl.rb
require 'rubygems'
require 'meow'
require 'mechanize'
require 'yaml'
require 'optparse'
require 'kconv'
class Kosoan
DURATION = 10 # min
@yhara
yhara / du.ru
Created Oct 12, 2008
A sample code of 'treemap' gem (and Rack). [1] du ~/ > a.du [2] edit path to a.du [3] rackup du.ru
View du.ru
require 'yaml'
require 'rubygems'
require 'treemap'
require 'rack'
# monkey patch for treemap :-(
class Treemap::HtmlOutput
def node_label(node)
node.label
end
View re.vim
" Vim syntax file
" Language: ReVIEW
" Maintainer: HARA, Yutaka (yhara/at/kmc.gr.jp)
" URL: http://route477.net/
" Latest Revision: ?
" arch-tag: ?
if version < 600
syntax clear
elseif exists("b:current_syntax")
View re.vim
" Vim syntax file
" Language: ReVIEW
" Maintainer: HARA, Yutaka (yhara/at/kmc.gr.jp)
" URL: http://route477.net/
" Latest Revision: ?
" arch-tag: ?
if version < 600
syntax clear
elseif exists("b:current_syntax")
@yhara
yhara / nabeatsu-run.rb
Created Oct 19, 2008
「世界のナベアツ問題」をRubyで解いてみました。Unicodeで保存し、 ruby -Ku nabeatsu-run.rb で実行してください
View nabeatsu-run.rb
# coding: utf-8
require 'nabeatsu'
include Nabeatsu
(1.から 40).まで{
3.の倍数 3.がつく数字 の時だけ アホに なって
5.の倍数 の時だけ 犬っぽく なって
8.の倍数 の時だけ 気持ちよく なります
}
View japanespec.rb
# coding: utf-8
module Japanespec
def 仕様(&block); end
def 例外(*args); end
def なる; end
def 含む; end
def を持つ; end
def に応答する; end
def マッチする; end
def 満たす; end
View japanespec.rb
# coding: utf-8
module Japanespec
def 仕様(&block); end
def 例外(*args); end
def なる; end
def 含む; end
def を持つ; end
def に応答する; end
def マッチする; end
def 満たす; end
View japanespec.rb
# coding: utf-8
module Japanespec
def 仕様(&block); end
def 例外(*args); end
def なる; end
def 含む; end
def を持つ; end
def に応答する; end
def マッチする; end
def 満たす; end
@yhara
yhara / japanespec.rb
Created Oct 20, 2008
日本語でRSpecしてみた
View japanespec.rb
# coding: utf-8
module Japanespec
def 仕様(&block); end
def 例外(*args); end
def なる; end
def 含む; end
def を持つ; end
def に応答する; end
def マッチする; end
def 満たす; end