Skip to content

Instantly share code, notes, and snippets.

View stepchud's full-sized avatar

Stephen Chudleigh stepchud

View GitHub Profile
@stepchud
stepchud / ruby_exception_hierarchy.rb
Created August 21, 2015 20:07
Have ruby print its own Exception class tree
#!/usr/bin/env ruby
# copied from http://blog.nicksieger.com/articles/2006/09/06/rubys-exception-hierarchy
# still relevant after all this time.
exceptions = []
tree = {}
ObjectSpace.each_object(Class) do |cls|
next unless cls.ancestors.include? Exception
next if exceptions.include? cls
next if cls.superclass == SystemCallError # avoid dumping Errno's
<!DOCTYPE html>
<html>
<head>
<script src="https://www.dropbox.com/s/l6hgjq7mh52o6od/spiceworks-sdk.js?dl=1&raw=1" type="text/javascript"></script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
var card = new SW.Card();
var inventory = card.services('inventory');
inventory.request('devices').then(function(data){
@stepchud
stepchud / gist:2241056
Created March 29, 2012 18:01 — forked from phillipkoebbe/gist:1457544
Installing ruby-debug19 on ruby 1.9.3-p0 on Mac OS X Lion 10.7.2 with Xcode 4.2.1
# assumes 1.9.3-p0 is already installed in RVM (1.9.2) and you are in an empty gemset
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
gem install rake
gem install archive-tar-minitar
gem install ruby_core_source
gem install columnize
gem install linecache19-0.5.13.gem -- --with-ruby-include="$rvm_path/src/`rvm tools strings`"
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include="$rvm_path/src/`rvm tools strings`"
@stepchud
stepchud / gist:775389
Created January 11, 2011 23:35
run individual tests to your <3s delight
#!/usr/bin/env ruby
def rake_test_loader_path
"/usr/local/rvm/gems/ruby-1.9.2-p0@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
end
def test_cmd_pre
%|ruby -I'lib:test' '#{rake_test_loader_path}' |
end