This file contains hidden or 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 Proxy | |
def self.proxy(context, &blk) | |
p = new(context) | |
p.__proxy &blk | |
p | |
end | |
def initialize(context) | |
@context = context | |
end |
This file contains hidden or 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 Proxy | |
def proxy(context, &blk) | |
@context = context | |
@blk = blk | |
end | |
def method_missing(method, *args, &blk) | |
__object.send(method, *args, &blk) | |
end |
This file contains hidden or 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 A | |
module B | |
end | |
end | |
module C | |
include A | |
puts B.inspect # => A::B |
This file contains hidden or 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 Common | |
module Client | |
module FaradayConnection | |
end | |
end | |
end | |
module Pullson |
This file contains hidden or 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
[4] pry(main)> mod = Module.new | |
=> #<Module:0x007fa1ac93c650> | |
[5] pry(main)> mod::Foo = Class.new | |
=> #<Class:0x007fa1ae5ad7f8> | |
[6] pry(main)> mod::Foo | |
=> #<Class:0x007fa1ae5ad7f8> | |
[7] pry(main)> mod::Foo.parent | |
=> Object |
This file contains hidden or 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
@test "tmux is installed and in the path" { | |
which vim | |
which derp | |
} | |
Uploading /tmp/busser/suites/bats/vim_stuff.rb (mode=0644) | |
-----> Running bats test suite | |
0 tests, 0 failures | |
Finished verifying <default-ubuntu-1204> (0m1.05s). |
This file contains hidden or 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 SemiOpenStruct | |
def initialize(hash={}) | |
@hash = hash | |
end | |
def method_missing(method,*args,&block) | |
@hash[method] || | |
__try_hash_setter(method,*args,&block) || | |
super | |
end |
This file contains hidden or 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 UserFinder | |
def self.find(id) | |
record = User.find(id) | |
"#{record.user_type}User".constantize.new(record) | |
end | |
end | |
class User < ActiveRecord::Base | |
end |
This file contains hidden or 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
#pseudo code | |
class Rollout | |
def auto_disable(feature, user, feature_block, old_block) | |
if active?(feature, user) | |
begin | |
yield feature_block | |
rescue => e | |
deactivate(feature) | |
raise e |
This file contains hidden or 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
find ./ -name rollout_ui | sed 's/\(.*\)/\1\/ \1/' | sed 's/rollout_ui$/lk_rollout_ui/' | xargs -n2 git mv |