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-1.8.7-p174 > WeakRef.public_instance_methods(false) | |
=> ["__setobj__", "__getobj__", "weakref_alive?"] | |
ruby-1.8.7-p174 > |
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
Loaded suite /Users/cowboyd/Projects/rdom/test/rdom/jquery_test | |
Started | |
F | |
Finished in 0.14056 seconds. | |
1) Failure: | |
test_can_load_jquery:15 | |
Exception raised: | |
Class: <V8::JSError> | |
Message: <"Cannot read property 'addEventListener' of undefined"> |
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
legolas:cucumber cowboyd$ RUBYLIB=/Users/cowboyd/Projects/therubyrhino/lib jruby -S bin/cucumber -v -i examples/v8/features | |
Using the default profile... | |
Code: | |
* examples/v8/features/support/env.js | |
Features: | |
* examples/v8/features/fibonacci.feature | |
Parsing feature files took 0m0.084s | |
Code: |
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 'v8' | |
include V8::C | |
print = FunctionTemplate::New() do |arguments| | |
for i in 0..arguments.Length() - 1 | |
print case arg = arguments[i] | |
when TrueClass,FalseClass, nil | |
arg | |
else |
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
@Extension | |
public class RubyExtensionFinder extends ExtensionFinder { | |
public RubyExtensionFinder() { | |
ScriptingContainer jruby = new ScriptingContainer(); | |
/** | |
* When run in the maven test suite, this line executes just fine | |
* but when instantiated by the Hudson server at runtime, gets the | |
* following error: no such file to load -- builtin/core_ext/symbol | |
* |
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
@Extension | |
public class MyExtensionFinder extends ExtensionFinder { | |
public <T> Collection<ExtensionComponent<T>> find(Class<T> tClass, Hudson hudson) { | |
System.out.printf("find(%s)\n", tClass.getName()); | |
return new ArrayList<ExtensionComponent<T>>(); | |
} | |
} | |
/** |
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
import hudson.Launcher; | |
import hudson.Extension; | |
import hudson.util.FormValidation; | |
import hudson.model.AbstractBuild; | |
import hudson.model.BuildListener; | |
import hudson.model.AbstractProject; | |
import hudson.tasks.Builder; | |
import hudson.tasks.BuildStepDescriptor; | |
import net.sf.json.JSONObject; | |
import org.kohsuke.stapler.DataBoundConstructor; |
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 'java' | |
list = java.util.ArrayList.new | |
list.add(1) | |
list.add(2) | |
puts list.inspect #=> <Java::JavaUtil::ArrayList:0x7dc21ece> | |
puts list.to_a.inspect #=> [1, 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
package foo; | |
import org.jruby.embed.ScriptingContainer; | |
import org.jruby.embed.LocalContextScope; | |
import org.jruby.embed.LocalVariableBehavior; | |
import org.jruby.embed.internal.LocalContext; | |
public class Fooby { | |
public static void main(String[] args) { |
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
A 5 vol% ethanol solution needs to be converted to wt% for the table in the | |
CRC Handbook of Chemistry and Physics, 62nd Ed, pg D-207. | |
The density of pure alcohol is 0.791 times that of water at 20 C. | |
Basis 100 ml solution: | |
alcohol = 5x0.791 = 3.955 grams | |
water = 95x1.00 = 95.000 | |
Total = 98.955 g | |
Wt% alcohol = 3.955/98.955 = 0.0400 -> 4.00 wt% alcohol. |