This file contains hidden or 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 Hundred | |
| def initialize(difficulty) | |
| @difficulty = difficulty | |
| @correct = 0 | |
| @error = 0 | |
| end | |
| def question | |
| case @difficulty | |
| when 1 |
This file contains hidden or 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
| puts "hello, goodbye!" |
This file contains hidden or 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 hidden or 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 hidden or 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 'rpn' | |
| class TestRPN < Test::Unit::TestCase | |
| def setup | |
| @rpn = RPN.new | |
| end | |
| def test_1_plus_1 | |
| assert_equal(2, @rpn.calc('1 1 +')) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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! |
OlderNewer