- 20 seconds until we start doing maven
- 45 seconds until we start running tests
- Time 8.11 seconds. Total time 53 seconds
- 23 seconds until we start doing maven
- 31 seconds until we start running tests
- Time 15.4 seconds. Total time 51 seconds
require 'thread' | |
require "benchmark" | |
module FibSolver | |
def self.fib(scheduler_queue, my_queue) | |
loop do | |
scheduler_queue << [:ready, my_queue] | |
message, *args = my_queue.pop | |
case message | |
when :fib |
Saving wrappers to '/Users/khutson/.rvm/wrappers/ruby-2.0.0-p247'........ | |
ruby-2.0.0-p247 - #importing default gemsets, this may take time............................... | |
/Users/khutson/.rvm/scripts/functions/support: line 291: 89701 Segmentation fault: 11 "$ruby_path" -rrbconfig -e '\ | |
File.open("'"$config_path"'","w") { |file| | |
RbConfig::CONFIG.sort.each{|key,value| | |
file.write("#{key.gsub(/\.|-/,"_")}=\"#{value.gsub("$","\\$")}\"\n") | |
} | |
} | |
' > /dev/null 2>&1 |
Kernel has a great method you can call. "caller". | |
Returns an array of the stack that called you. | |
So if you want to just see your immediate caller, | |
you can do puts "who called me caller=#{caller.first}" | |
and it will print the immediate caller. | |
If your method is being called from multiple clients this seems useful in debugging.. |
NOTE how to to look for stuff inside a directory of jar files from the command line | |
for i in *.jar; do jar -tvf "$i" | grep com.foo; done |
Sweet n Spicy pulled pork
We had some extra pork loin, cooked in a crock pot, then pulled.
I created this sauce that I let some of it simmer in. Delicious.
def do_it | |
#simplest possible thing..works..pub and sub together.. | |
puts "do it.." | |
EventMachine.run do | |
connection = AMQP.connect('amqp://guest:guest@localhost:5672') | |
puts "Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem..." | |
opts = {:durable => true, :ack => true} | |
ex_name = "my.exchange.name" | |
q_name = "myqueue" |
class BaseMessageHandler | |
def initialize(opts = {}) | |
@connection_string = opts[:rabbit_mq_host] | |
raise ConfigurationError.new('rabbit_mq_host is not specified') unless @connection_string | |
end | |
def fetch_channel | |
AMQP.start(@connection_string) do |connection, open_ok| | |
AMQP::Channel.new(connection) do |channel| | |
yield channel |
require 'java' | |
java_import 'java.util.concurrent.Executors' | |
java_import 'java.util.concurrent.TimeUnit' | |
class SomeClass | |
include java.lang.Runnable | |
def run | |
puts "imma lil jruby runner" | |
end | |
end |
my_rack_proc = lambda { |env| [200, {"Content-Type" => "text/plain"}, ["Hello. The time is #{Time.now}"]] } | |
puts my_rack_proc.call({}) | |
require 'rack' | |
Rack::Handler::WEBrick.run(my_rack_proc, :Port => 3000) |