Skip to content

Instantly share code, notes, and snippets.

View hosiawak's full-sized avatar

Karol Hosiawa hosiawak

View GitHub Profile
=== bin/rbx ===
decoding protobuf 87862.7 (±4.8%) i/s - 439806 in 5.018943s (cycle=6374)
startup 2.7 (±0.0%) i/s - 81 in 30.146214s (cycle=1)
degree_days 12.2 (±0.0%) i/s - 62 in 5.067835s (cycle=1)
#delete 10.5 (±0.0%) i/s - 53 in 5.055073s (cycle=1)
#add 17.7 (±5.7%) i/s - 89 in 5.039424s (cycle=1)
#search 73.8 (±6.8%) i/s - 372 in 5.067292s (cycle=6)
#inorder_walk 199.9 (±2.0%) i/s - 1007 in 5.039447s (cycle=19)
#rev_inorder_walk 203.2 (±1.5%) i/s - 1026 in 5.050822s (cycle=18)
#minimum 100.0 (±4.0%) i/s - 504 in 5.047642s (cycle=9)
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
def to_words(num)
a0 = %w{ one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen }
a1 = %w{ twenty thirty forty fifty sixty seventy eighty ninety }
case num
when 1..19
a0[num-1]
when 20..99
num % 10 != 0 ? "#{a1[(num-20)/10]}#{a0[num % 10 - 1]}" : a1[(num-20)/10]
when 100..999
num % 100 != 0 ? "#{to_words(num/100)}hundredand#{to_words(num % 100)}" : "#{to_words(num/100)}hundred"
diff --git a/kernel/loader.rb b/kernel/loader.rb
index 514453d..767820e 100644
--- a/kernel/loader.rb
+++ b/kernel/loader.rb
@@ -241,14 +241,9 @@ containing the Rubinius standard library files.
options.on "-c", "FILE", "Check the syntax of FILE" do |file|
if File.exists?(file)
- case
- when Rubinius.ruby18?
<div id="print_box">
<ul>
<li><img src="/system/development/documents/000/000/800/thumb/910.png"/></li>
<li><img src="/system/development/documents/000/000/793/thumb/903.png"/></li>
<li><img src="/system/development/documents/000/000/793/thumb/903.png"/></li>
<li><img src="/system/development/documents/000/000/800/thumb/910.png"/></li>
<li><img src="/system/development/documents/000/000/800/thumb/910.png"/></li>
</ul>
<div class="close"><a href="#close" title="Close this box">
</div>
[Thread 0xb43fbb70 (LWP 16335) exited]
[Thread 0xb47fcb70 (LWP 16341) exited]
[New Thread 0xb43fbb70 (LWP 16342)]
[New Thread 0xb47fcb70 (LWP 16343)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb47fcb70 (LWP 16343)]
rubinius::GarbageCollector::walk_call_frame (this=0x8ac96b8, top_call_frame=0xb43f9524) at vm/gc/gc.cpp:147
147 if(!call_frame->cm) {
(gdb) bt
describe "when passed URI" do
it "it prints the body of the specified uri to $stdout" do
120000.times do
lambda do
Net::HTTP.get_print URI.parse('http://localhost:3333/')
end.should output(/This is the index page\./)
end
end
end
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title></title>
</head>
<body>
<h1></h1>
def factorial(n, product)
if n == 0
product
else
recur(n - 1, n * product)
end
end
puts factorial(10_000)
class Parser < Stage
attr_accessor :transforms
def self.processor
case
when Rubinius.ruby18?
Rubinius::Melbourne
when Rubinius.ruby19?
Rubinius::Melbourne19
when Rubinius.ruby20?