Skip to content

Instantly share code, notes, and snippets.

View justincampbell's full-sized avatar
🌯
🍩

Justin Campbell justincampbell

🌯
🍩
View GitHub Profile
  • Foo
    • Bar
  • Bar
puts "Start parsing A"
require_relative 'b'
puts "Finish parsing A"
print "$foo_global_variable: "
p $foo_global_variable
print "@@foo_class_variable: "
class Thing
def foo(first, bar: 123)
__callee__ # => :foo
__dir__ # => "/private/var/folders/gz/5xvm5fkx79bdr3bnbchj68980000gn/T/seeing_is_believing_temp_dir20140501-76590-1yme1ex"
__id__ # => 70335328646640
__method__ # => :foo
binding # => #<Binding:0x007ff0708ee7d0>
caller # => ["/var/folders/gz/5xvm5fkx79bdr3bnbchj68980000gn/T/seeing_is_believing_temp_dir20140501-76590-1yme1ex/program.rb:29:in `<main>'"]
caller_locations # => ["/var/folders/gz/5xvm5fkx79bdr3bnbchj68980000gn/T/seeing_is_believing_temp_dir20140501-76590-1yme1ex/program.rb:29:in `<main>'"]
local_variables # => [:first, :bar, :args]
suites:
- name: default
run_list:
- recipe[drone::default]
- name: mysql
attributes:
drone:
droned_opts:
driver: sqlite3
run_list:
@justincampbell
justincampbell / allocate_vs_new.rb
Last active August 29, 2015 13:57
.allocate vs .new
puts RUBY_DESCRIPTION
require 'benchmark'
count = (ARGV[0] || 1_000_000).to_i
class Thing
def foo
:bar
end
require 'benchmark'
require 'active_support/core_ext'
class Transaction
attr_reader :amount
def initialize(amount)
@amount = amount
end
end
it "defines an open_close method that taps the pin" do
pin = runner.pins[:open_close]
expect(pin).to receive(:on)
expect(runner).to receive(:set_pin_in).with(pin, :off, 0.25)
runner.open_close
end
def tap_pin(pin)
set_pin(pin, :on)
set_pin_in(pin, :off, 0.25)
end
def set_pin(pin, state)
return if read_pin(pin) == state
pin.send(state)
end
diff --git a/client/tomcatconf/simulatorComponentContext.xml.in b/client/tomcatconf/simulatorComponentContext.xml.in
index 7225e84..9c02efa 100644
--- a/client/tomcatconf/simulatorComponentContext.xml.in
+++ b/client/tomcatconf/simulatorComponentContext.xml.in
@@ -251,4 +251,14 @@
<property name="name" value="ExplicitDedicationProcessor"/>
<property name="type" value="ExplicitDedication"/>
</bean>
+
+<bean id="eventNotificationBus" class="org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus">
def reset
Object.send :remove_const, 'Person'
end
# Inheriting from struct
class Person < Struct.new(:first_name, :last_name)
def full_name
[first_name, last_name].compact.join(' ')
end
end