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 Rectangle | |
def initialize(length, breadth) | |
@length = length | |
@breadth = breadth | |
end | |
def perimeter | |
2 * (@length + @breadth) | |
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
class Queen | |
def initialize(arrayLength) | |
@array = Array.new(arrayLength) | |
end | |
def starter | |
enumerate(@array,0) | |
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
JS.Benchmarks.fact = function(n){ | |
if(n > 1) { | |
return n * this.fact(n-1); | |
} | |
else { | |
return 1; | |
} | |
} |
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
module Benchmarks | |
def self.fact_inline_js(n) | |
%x{ | |
if(n > 1) { | |
return n * this.$fact_inline_js(n-1); | |
} | |
else { | |
return 1; | |
} | |
} |
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
(function(undefined) { | |
if (typeof(this.Opal) !== 'undefined') { | |
console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.'); | |
return this.Opal; | |
} | |
// The Opal object that is exposed globally | |
var Opal = this.Opal = {}; | |
// All bridged classes - keep track to donate methods from Object |
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 File.expand_path('../../../spec_helper', __FILE__) | |
require File.expand_path('../shared/dup_clone', __FILE__) | |
describe "Object#clone" do | |
it_behaves_like :object_dup_clone, :clone | |
it "preserves frozen state from the original" do | |
o = ObjectSpecDupInitCopy.new | |
o2 = o.clone | |
o.freeze |
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 File.expand_path('../../../spec_helper', __FILE__) | |
require File.expand_path('../fixtures/classes', __FILE__) | |
require File.expand_path('../shared/clone', __FILE__) | |
describe "Array#clone" do | |
it_behaves_like :array_clone, :clone | |
it "copies frozen status from the original" do | |
a = [1, 2, 3, 4] | |
b = [1, 2, 3, 4] |
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 'wrest' | |
require 'pp' | |
Wrest.logger = Logger.new(STDOUT) | |
Wrest.logger.level = Logger::DEBUG # Set this to Logger::INFO or higher to disable request logging | |
# This example demonstrates the usage of GET, POST, PUT and | |
# DELETE over HTTPS. Its also shows how Wrest::Uris can have | |
# paths extended making accessing an API easy as pie. | |
# |
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
How the time for dreams of the future seemed to slip past unnoticed, until in reviving them a man realized, with a shock, that the privilege was no longer his to entertain, that it belonged to those younger faces he saw on all sides, laughing in the tavern and on the streets, _running wild_. |
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
~ λ jruby -v | |
jruby 1.4.0dev (ruby 1.8.7p174) (2009-08-05 619cebe) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java] | |
~ λ jirb | |
irb(main):001:0> {}.eql?({}) | |
=> true | |
irb(main):002:0> [].eql?([]) | |
=> true |
OlderNewer