This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'stack' | |
class RPN | |
def initialize | |
@stack = Stack.new | |
end | |
def calc(expr) | |
expr.split.each do |e| | |
if %w[ + - * / ].include? e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" for .vimperatorrc | |
" 個人的に追加するコマンド達 | |
javascript <<EOM | |
(function () { | |
[ | |
['gmail', 'http://mail.google.com/', 'open Gmail'], | |
['gnews', 'http://news.google.co.jp/', 'open Google News'], | |
['gusnews', 'http://news.google.co.jp/news?ned=us', 'open Google News (U.S)'], | |
['gmap', 'http://maps.google.co.jp/', 'open Google Maps'], | |
['greader', 'http://www.google.com/reader/', 'open Google Reader'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
require 'stack' | |
class TestStack < Test::Unit::TestCase | |
def setup | |
@stack = Stack.new | |
end | |
def test_empty? | |
assert(@stack.empty?) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmptyStackError < StandardError; end | |
class Stack | |
def initialize | |
@stack = [] | |
@size = 0 | |
end | |
def empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mini/test' | |
Mini::Test.autorun | |
class StackOverflow < StandardError; end | |
class EmptyStackError < StandardError; end | |
class Stack | |
def initialize(max = 1.0/0.0) | |
@stack = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mini/spec' | |
Mini::Test.autorun | |
class EmptyStackError < StandardError; end | |
class Stack | |
def initialize | |
@stack = [] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vimperator plugin *MODOKI* | |
" | |
" USAGA: | |
" :gosh S式 | |
(function() { | |
liberator.commands.addUserCommand(['gosh'], 'Evalute gauche code', | |
function(arg, special) { | |
// Set your gosh path! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// listgmail.js | |
// View new mail list on Gmail. | |
// tomohiro nishimura ( tomohiro68__at__gmail.con ) | |
// | |
// 参考: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/gmail_biff.js | |
liberator.plugins.sbmCommentsViewer = (function(){ | |
liberator.commands.addUserCommand(['newmail', 'gnew'], 'List up new mail on gmail', | |
function(argument, special){ | |
setTimeout(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# よくわからない習作 | |
me = Object.new | |
class << me | |
def get_bind | |
binding | |
end | |
def method_missing(name, *arg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'RMagick' | |
1.upto 50 do |idx| | |
file = Dir["#{idx}/*.*"].first | |
p file | |
if file | |
img = Magick::ImageList.new(file).first | |
img.change_geometry('600x600') do |c, l, i| | |
i.resize! c, l |