Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Formats a man page for reading in a browser, and opens it. Example:
#
# hman xsltproc
#
stylesheet=$(cat <<eocss
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
class Module
def protocol(proto_name)
@current_protocol = proto_name.to_sym
end
def protocols
@protocols ||= Hash.new{|h,k| h[k] = []}
end
def method_added(name)
total 8
drwxr-xr-x 43 gabriel wheel 1462 Feb 24 23:01 Cellar
drwxr-xr-x 6 gabriel wheel 204 Aug 8 2010 Library
-rw-r--r-- 1 gabriel wheel 1613 Nov 4 22:54 README.md
drwxr-xr-x 364 gabriel wheel 12376 Feb 24 23:01 bin
drwxr-xr-x 11 gabriel wheel 374 Feb 15 22:46 etc
drwxr-xr-x 45 gabriel wheel 1530 Nov 4 23:03 include
drwxr-xr-x 219 gabriel wheel 7446 Feb 15 22:46 lib
drwxrwxr-x 11 gabriel wheel 374 Oct 6 19:24 libexec
drwxrwxr-x 7 gabriel wheel 238 Oct 12 11:37 sbin
class Class
def seal!
class_eval do
def self.method_added(method_name)
Object.const_set(name, @sealed) if defined?(@sealed)
end
def self.singleton_method_added(method_name)
Object.const_set(name, @sealed) if defined?(@sealed)
class Tricksy
def self.lulz
puts "denied"
end
def self.singleton_method_added(name)
Object.const_set(:Tricksy, RealTricksy) if defined?(RealTricksy)
end
RealTricksy = self.clone
diff --git a/lib/riot/context.rb b/lib/riot/context.rb
index 8532ccd..324f395 100644
--- a/lib/riot/context.rb
+++ b/lib/riot/context.rb
@@ -1,5 +1,10 @@
module Riot
- RootContext = Struct.new(:setups, :teardowns)
+ RootContext = Struct.new(:setups, :teardowns) do
+ def assertion_class
+ Assertion
diff --git a/lib/riot/context.rb b/lib/riot/context.rb
index a1231d7..8532ccd 100644
--- a/lib/riot/context.rb
+++ b/lib/riot/context.rb
@@ -20,7 +20,7 @@ module Riot
def asserts_topic; asserts("topic") { topic }; end
def context(description, &definition)
- @contexts << Context.new("#{@description} #{description}", self, &definition)
+ @contexts << self.class.new("#{@description} #{description}", self, &definition)
echoplex:rhino-test gabriel$ javagem install js
Successfully installed js-1.7.2
1 gem installed
Installing ri documentation for js-1.7.2...
Installing RDoc documentation for js-1.7.2...
echoplex:rhino-test gabriel$ echo "gem 'js'" > Gemfile
echoplex:rhino-test gabriel$ jam org.mozilla.javascript.tools.shell.Main
Rhino 1.7 release 2 2009 03 22
js>
gabriels-vmware-virtual-platform:~ gabriel$ sudo gem update --system
Updating RubyGems...
ERROR: While executing gem ... (Gem::RemoteSourceException)
HTTP Response 403 fetching http://gems.rubyforge.org/yaml
gabriels-vmware-virtual-platform:~ gabriel$
echoplex:clojure-with-contrib-hello-world gabriel$ ls
Gemfile README.markdown
echoplex:clojure-with-contrib-hello-world gabriel$ cat Gemfile
gem "clojure-contrib"
echoplex:clojure-with-contrib-hello-world gabriel$ java -cp `javagem classpath` clojure.main -e '(println "hello, world")'
hello, world
echoplex:clojure-with-contrib-hello-world gabriel$ javagem classpath
/Users/gabriel/.javagem/java/gems/clojure-1.0.0/lib:/Users/gabriel/.javagem/java/gems/clojure-contrib-0.1.1/lib
echoplex:clojure-with-contrib-hello-world gabriel$