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 Hamster | |
def self.vector(*args) | |
Vector.new(args) | |
end | |
class Vector < ::Array | |
alias add << | |
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 'yaml' | |
class X | |
def self.y | |
YAML.load_file("abc") | |
end | |
end | |
RSpec.describe X do | |
it 'works' 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
RSpec::Matchers.define_negated_matcher :avoid_outputting, :output | |
RSpec.configure do |config| | |
config.around do |ex| | |
expect(&ex).to avoid_outputting.to_stdout.and avoid_outputting.to_stderr | |
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 'versionable' | |
class Subscription | |
include Ripple::Document | |
include Versionable | |
current_schema_version 2 | |
migrate_schema do |data| | |
self.schema_version = 2 |
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
max_stack_frames = 500 | |
TooManyStackFrames = Class.new(StandardError) | |
TracePoint.new(:call) do |tp| | |
if caller.size >= max_stack_frames | |
raise TooManyStackFrames, "Stack has exceeded #{max_stack_frames} frames" | |
end | |
end.enable |
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
#!/bin/bash | |
set -ex | |
mkdir -p /tmp/repro-bundle-standalone-failure | |
cd /tmp/repro-bundle-standalone-failure | |
bundle env | |
# Bundler 1.5.2 | |
# Ruby 1.9.3 (2013-06-27 patchlevel 448) [x86_64-darwin12.4.0] |
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 'httpclient' | |
client = HTTPClient.new | |
response = client.request(:get, "http://google.com/", nil, '', {}) | |
puts "Headers:" | |
response.headers.each do |key, value| | |
puts "#{key} (#{key.encoding.name}): #{value} (#{value.encoding.name})" | |
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 'yaml' | |
string = "a string".force_encoding("ASCII-8BIT") | |
puts YAML.dump(string) |
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
def cancel_all_failed_jobs(redis) | |
qless = Qless::Client.new(redis: redis) | |
qless.jobs.failed.each do |key, count| | |
puts "#{key}: #{count}" | |
while (jobs = qless.jobs.failed(key, 0, 1000).fetch("jobs")).any? | |
qless.bulk_cancel(jobs.map(&:jid)) | |
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
From ff210553f1a66db745a32224ff69b57073f953c6 Mon Sep 17 00:00:00 2001 | |
From: Myron Marston <myron.marston@gmail.com> | |
Date: Mon, 27 Feb 2017 15:01:27 -0800 | |
Subject: [PATCH] WIP: add monitor statements. | |
--- | |
lib/mix/lib/mix/dep/converger.ex | 120 ++++++++++++++++++++++----------------- | |
1 file changed, 67 insertions(+), 53 deletions(-) | |
diff --git a/lib/mix/lib/mix/dep/converger.ex b/lib/mix/lib/mix/dep/converger.ex |