Skip to content

Instantly share code, notes, and snippets.

@munkyboy
munkyboy / .block
Last active November 2, 2017 22:31 — forked from mbostock/.block
A Bar Chart
height: 930
license: gpl-3.0
@munkyboy
munkyboy / Makefile
Last active August 29, 2015 14:06 — forked from mbostock/.block
GENERATED_FILES = \
unemployment.tsv
.PHONY: all clean
all: $(GENERATED_FILES)
clean:
rm -rf -- $(GENERATED_FILES)
@munkyboy
munkyboy / memleak.rb
Created December 22, 2010 01:59
script that shows memleak in jruby on certain windows platforms
require 'java'
require 'benchmark'
def foo
Benchmark.measure {
sc = org.jruby.embed.ScriptingContainer.new(org.jruby.embed.LocalContextScope::SINGLETHREAD, org.jruby.embed.LocalVariableBehavior::TRANSIENT)
sc.runScriptlet("require 'rubygems'")
sc.terminate
sc = nil
}
diff --git a/lib/rspec/core/formatters/base_formatter.rb b/lib/rspec/core/formatters/base_formatter.rb
index fc181fb..8f88433 100644
--- a/lib/rspec/core/formatters/base_formatter.rb
+++ b/lib/rspec/core/formatters/base_formatter.rb
@@ -118,7 +118,7 @@ module RSpec
def read_failed_line(exception, example)
original_file = example.file_path.to_s.downcase
- matching_line = exception.backtrace.detect { |line| line.match(/(.+?):(\d+)(|:\d+)/)[1].downcase == original_file.downcase }
+ matching_line = exception.backtrace.detect { |line| (line.match(/(.+?):(\d+)(|:\d+)/).downcase == original_file.downcase) rescue false }
diff --git a/lib/ruby/site_ruby/1.8/rubygems/config_file.rb b/lib/ruby/site_ruby/1.8/rubygems/config_file.rb
index 7eb755a..8eac97d 100644
--- a/lib/ruby/site_ruby/1.8/rubygems/config_file.rb
+++ b/lib/ruby/site_ruby/1.8/rubygems/config_file.rb
@@ -52,13 +52,13 @@ class Gem::ConfigFile
CSIDL_COMMON_APPDATA = 0x0023
path = 0.chr * 260
if RUBY_VERSION > '1.9' then
- SHGetFolderPath = Win32API.new 'shell32', 'SHGetFolderPath', 'PLPLP',
+ f = Win32API.new 'shell32', 'SHGetFolderPath', 'PLPLP',