- Shrink to Grow(Daniel Bovensiepen)
- Identical Production, Staging and Development Environments Using Chef, AWS and Vagrant(Christopher Rigor)
- Fewer Constraints, More Concurrency.(Ryan Smith)
- Webruby: Now you can write your favorite Ruby code for the browser!(Xuejie "Rafael" Xiao)
- Contributing to Ruby(Zachary Scott)
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
require 'v8' | |
v8 = V8::Context.new | |
r = v8.eval 'a = {"b": 310399688698392577}' | |
r[b].to_i # => 310399688698392576 (expected: 310399688698392577) |
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
require 'tsort' | |
require 'pp' | |
Node = Struct.new :value, :before, :after | |
class Collection < Array | |
include TSort | |
alias :tsort_each_node :each | |
def tsort_each_child(current, &block) |
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
def Object.superclasses | |
superclasses = superclass.superclasses if superclass.respond_to?(:superclasses) | |
superclasses ||= [] | |
superclasses.unshift self | |
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 A | |
class << self | |
def add(ele) | |
@array ||= [] | |
@array << ele | |
end | |
def array | |
@array ||= [] | |
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
jobs_per_process = 100 | |
process_count = 10 | |
User.find_in_batches(:batch_size => jobs_per_process * process_count, :conditions => "name like '%00'") do |group| | |
batches = group.in_groups(process_count) | |
batches.each do |batch| | |
Process.fork do | |
ActiveRecord::Base.establish_connection | |
batch.reject { |user| user.nil? }. | |
each {|user| puts user.name } |
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 A | |
def f() 'A#f' end | |
end | |
module M | |
def f() 'M#f' end | |
def g() 'M#g' end | |
def k() 'M#k' end | |
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
def run_filters(&blk) | |
m = Module.new do | |
extend self | |
@__filter_endpoint = blk | |
end | |
code = '@__filter_endpoint.call' | |
filter_methods = private_methods.grep(/^filter_/) | |
filter_methods.each do |meth| | |
m.send(:define_method, "__filter_#{meth}", method(meth)) | |
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
Errno::ENOSYS: Function not implemented | |
Errno::EDESTADDRREQ: Destination address required | |
Errno::ESHUTDOWN: Can't send after socket shutdown | |
Errno::ENODEV: Operation not supported by device | |
Errno::ENOMEM: Cannot allocate memory | |
Errno::EMLINK: Too many links | |
Errno::EPROTO: Protocol error | |
Errno::ENETUNREACH: Network is unreachable | |
Errno::EIO: Input/output error | |
Errno::EMFILE: Too many open files |
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
From: /Users/zhour6/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/webrick/httputils.rb @ line 444 WEBrick::HTTPUtils._escape: | |
440: def _escape(str, regex) | |
441: begin | |
442: str.gsub(regex){ "%%%02X" % $1.ord } | |
443: rescue Exception | |
=> 444: require 'pry'; binding.pry | |
445: end | |
446: end |