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 'benchmark' | |
require 'sidekiq/limit_fetch' | |
require 'sidekiq/cli' | |
total = ARGV.shift || 50 | |
concurrency = ARGV.shift || 1 | |
limit = ARGV.shift | |
total = total.to_i | |
limit &&= limit.to_i |
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
$:.unshift '.' | |
require 'rake' | |
load 'Rakefile' | |
load 'rakelib/kernel.rake' | |
require 'lib/mri_bridge.rb' | |
require 'lib/melbourne.rb' | |
require 'lib/compiler' | |
File.to_ast 'kernel/bootstrap/basicobject.rb' |
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
Gem::Specification.new do |s| | |
s.name = 'cassandra-schema_dsl' | |
s.version = '0.1' | |
s.author = 'brainopia' | |
s.summary = 'Cassandra schema dsl' | |
s.files = ['cassandra-schema_dsl.rb'] | |
s.require_path = '.' | |
s.add_dependency 'cassandra' |
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 Octokit::Mirror | |
attr_reader :remaining, :reserved | |
def initialize(options={}) | |
@client = Octokit::Client.new options | |
@remaining = Atomic.new Float::INFINITY | |
@reserved = Atomic.new 0 | |
@monitor = Atomic.new 0 | |
end | |
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 'delegate' | |
class Task | |
extend Forwardable | |
def_delegators 'self.class', :collection, :indication | |
class << self | |
def queues | |
[OrgRepos, Members, Orgs, Projects, Users, Stars, Contributions] | |
end |
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 'eventmachine' | |
class Request < EM::P::HeaderAndContentProtocol | |
CRLF = "\r\n" | |
def receive_request(headers, body) | |
receive_full_request headers.join(CRLF) << CRLF*2 << body | |
end | |
end |
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 'em-proxy' | |
Proxy.start host: '0.0.0.0', port: ENV['PORT'] do |connection| | |
connection.server :github, host: 'api.github.com', port: 443 | |
ok_response = "HTTP/1.1 200 Ok\r\n\r\n" | |
connect_verb = /\Aconnect/i | |
connection.on_data do |data| | |
if data =~ connect_verb |
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
cd $rvm_path/src/${MY_RUBY_HOME##*/}/ext/openssl | |
rvm pkg install openssl | |
ruby extconf.rb -- --with-openssl-dir="$rvm_path/usr" | |
make install | |
cd $rvm_path/usr/ssl | |
curl http://curl.haxx.se/ca/cacert.pem > cert.pem |
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
module A | |
# prefer when there are less than three class methods | |
# and there are instance methods | |
def self.boo | |
end | |
def self.soo | |
end | |
def fuuu |
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
# eval with method definition is used to prevent warnings in some situations | |
DEFINEE = <<-CODE | |
eval 'def __; end' | |
it = method(:__).owner rescue instance_method(:__).owner | |
eval 'undef __' | |
it | |
CODE | |
self # => main |