Skip to content

Instantly share code, notes, and snippets.

* [[CallingJavaFromJRuby|Scripting Java from JRuby]]
renders on github as
<a class="internal absent" href="/jruby/jruby/wiki/Scripting-Java-from-JRuby">CallingJavaFromJRuby</a>
instead of rendering as
<a class="internal absent" href="/jruby/jruby/wiki/CallingJavaFromJRuby">Scripting Java from JRuby</a>
1.5.6
Finished in 12.932 seconds
538 examples, 0 failures, 11 pending
--------------------------------------
1.6.0-dev (5573d703082b554cde7a3bed0fe26b7479187ec8) # just before rspec upgrade
Finished in 29.146 seconds
557 examples, 0 failures, 7 pending
---------------------------------------
@qmx
qmx / web.xml
Created January 22, 2011 14:17
<filter>
<filter-name>OEMIV</filter-name>
<filter-class>br.com.caelum.financas.util.EntityManagerInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OEMIV</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
ResourceBundle bundle = ResourceBundle.getBundle("queries");
String query = bundle.getString("Usuario.all"); // select u from Usuario u
@qmx
qmx / test.rb
Created February 14, 2011 11:28
jruby 1.5.6 (ruby 1.8.7 patchlevel 249) (2011-02-14 e34fde6) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [x86_64-java]
gzip on;
gzip_types text/plain text/xml text/css application/javascript application/x-javascript;
location ~* \.(ico|css|js|gif|jp?g|png|swf)(\?[0-9]+)?$ {
expires max;
}
@JRubyClass(name = "Date")
public class RubyDate extends RubyObject {
public static class RubyDateSingleton {
@JRubyMethod(name = "jd_to_civil", required = 1, optional = 1, visibility = Visibility.PRIVATE)
public IRubyObject jd_to_civil(ThreadContext ctx, IRubyObject[] args) {
System.out.println("LOOOOL");
return ctx.nil;
}
}
// first iteration: simple guard by version string
if(isRubyVersion("1.9.2-p136")){
// ....
}
// second iteration: Version object with semantic versioning, etc
RubyVersion v = version("1.9.2-p136");
v.major() // 1.9
v.minor() // 2
@qmx
qmx / Gemfile
Created June 10, 2011 03:25 — forked from napcs/Gemfile
warbler + sinatra problem
source :rubygems
gem 'sinatra', '1.2.3'
gem 'tilt', "1.3"
gem 'rack', "1.2.2"
gem 'sinatra-respond_to', '0.7.0'
Compiled from "ClosureTest.java"
final class ClosureTest$1 implements ClosureTest$Closure {
final java.lang.Object val$o;
ClosureTest$1(java.lang.Object);
Code:
0: aload_0
1: aload_1
2: putfield #1 // Field val$o:Ljava/lang/Object;
5: aload_0