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
2.2.0 :001 > class A | |
2.2.0 :002?> end | |
=> nil | |
2.2.0 :003 > class B < A | |
2.2.0 :004?> end | |
=> nil | |
2.2.0 :005 > a = A.new | |
=> #<A:0x0000000155df60> | |
2.2.0 :006 > b = B.new | |
=> #<B:0x00000001542670> |
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 Optimizing | |
def assert(cond) | |
if !cond | |
raise "Assert Failure" | |
end | |
end | |
def color_by_score(score) | |
assert (score >= 0 && score <= 100) |
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
import org.apache.curator.test.TestingServer | |
object Main { | |
var zkServer: TestingServer = _ | |
def main(args: Array[String]): Unit = { | |
zkServer = new TestingServer(3181) | |
zkServer.start() | |
} | |
} |
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
source "http://rubygems.org" | |
ruby '2.2.0', engine: 'jruby', engine_version: '9.0.0.0.pre1' | |
gem 'rack' | |
gem "torquebox-web", "4.0.0.alpha1" |
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 'zookeeper' | |
class ZKWalk | |
def initialize(zk = Zookeeper.new('localhost:2181')) | |
@zk = zk | |
end | |
def walk (path, max_depth = -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
class Test | |
def self.vi(a, b="0", c="0") | |
a.to_i * 10000 + b.to_i * 100.to_i + c.to_i | |
end | |
def self.version_to_number(s) | |
begin | |
a = s.split "." | |
ret = |
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
puts "__FILE__:#{__FILE__}" | |
puts "File.dirname(__FILE__):#{File.dirname(__FILE__)}" | |
puts "File.expand_path(File.dirname(__FILE__)): #{File.expand_path(File.dirname(__FILE__))}" | |
puts "File.expand_path(File.dirname(__FILE__) + '../lib'): #{File.expand_path(File.dirname(__FILE__) + '../lib')}" | |
# __FILE__:a.rb | |
# File.dirname(__FILE__):. |
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
package test.test; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.Callable; | |
import org.jruby.embed.LocalContextScope; | |
import org.jruby.embed.ScriptingContainer; | |
/* |
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
import akka.actor.ActorSystem | |
import akka.stream.FlowMaterializer | |
import akka.http.Http | |
import akka.http.model._ | |
import akka.http.model.HttpMethods._ | |
object Main { | |
def main(args: Array[String]): Unit = { |
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 "http" | |
client = HTTP::Client.new("localhost", 8080) | |
resp = client.get "/" | |
p resp.status_code | |
resp.headers.each do |k, v| | |
puts "#{k}= #{v}" | |
end |