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 Test | |
__field_missing: (name) => | |
print "method is missing:", name | |
old = @__base.__index | |
@__base.__index = (name) => | |
old[name] or @__field_missing name | |
x = Test! |
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 FakeRedis | |
new: => | |
@called = {} | |
for m in *{ "set_timeout", "connect", "multi", "sadd", } | |
@__base[m] = (...) => | |
@called[m] = ... | |
true | |
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
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | |
# Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } | |
load 'config/deploy' # remove this line to skip loading any of the default tasks | |
after 'deploy:finalize_code', 'deploy:web:disable' | |
after 'deploy:start', 'deploy:web:enable' | |
namespace :deploy do |
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
ruby_block "rvm use default" do | |
block do | |
Chef::Mixin::Command.popen4('bash -l -c "rvm use default && env"') do |p,i,o,e| | |
o.each_line do |line| | |
next if line.nil? | |
line.chomp! | |
next if line.empty? | |
env_bits = line.split("=") | |
ENV[env_bits[0]] = env_bits[1] |
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
# hack for the chef - we cannot read file in http_request resource | |
ruby_block "Set attributes for http request for #{database[:name]} #{database[:kind]}" do | |
block do | |
request = resources(:http_request => "Create backup record for #{database[:name]} #{database[:kind]}") | |
request.message({:backup => {:filename => compressed_file_name, :kind => database[:kind], :size => File.size(compressed_file_path)}}) | |
end | |
end | |
http_request "Create backup record for #{database[:name]} #{database[:kind]}" do | |
url "http://some-url/backups" |
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
if defined?(::Bundler) | |
global_gemset = ENV['GEM_PATH'].split(':').grep(/ruby.*@global/).first | |
if global_gemset | |
all_global_gem_paths = Dir.glob("#{global_gemset}/gems/*") | |
all_global_gem_paths.each do |p| | |
gem_path = "#{p}/lib" | |
$LOAD_PATH << gem_path | |
end | |
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 'guard/rspec' | |
extensions = ["Guard::RSpec", "Guard::Schema", "Guard::Routes"] | |
module ::Guard | |
class Schema < ::Guard::Guard | |
def run_on_change(_) | |
UI.info "Clearing the way" | |
`rake db:test:prepare` | |
UI.clear | |
UI.info "Ready to lead the charge!" |
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 'daemon_controller' | |
require 'socket' | |
REPO_DIR = '/path/to/repos' | |
WHITELIST = %w{hostthis} | |
LISTEN = '1.2.3.4' | |
PORT = '9418' | |
PID_FILE = 'git-daemon.pid' | |
LOG_FILE = 'git-daemon.log' | |
LOCK_FILE = "#{PID_FILE}.lock" |
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 "active_record" | |
require "lib/duration" | |
class Event < ActiveRecord::Base | |
include Duration | |
end | |
describe Duration do | |
before do | |
ActiveRecord::Base.establish_connection( |
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
Resque::Failure::SensitiveAirbrake.configure do |config| | |
config.api_key = @config['airbrake']['api_key'] | |
config.params_filters << 'my_sensitive_job_arg' | |
config.secure = @config['airbrake']['secure'] | |
config.proxy_host = @config['airbrake']['proxy_host'] | |
config.proxy_port = @config['airbrake']['proxy_port'] | |
config.host = @config['airbrake']['host'] | |
config.logger = Logger.new(STDOUT) | |
end |
OlderNewer