Skip to content

Instantly share code, notes, and snippets.

require 'jdbc/sqlite3'
Jdbc::SQLite3.load_driver
Java::org.sqlite.JDBC
url = "jdbc:sqlite:test.db"
con = java.sql.DriverManager.get_connection url
statement = con.create_statement
statement.execute("create table people (id int PRIMARY_KEY)")
@enebo
enebo / aaaa
Created January 19, 2023 19:44
enebo: ruby -I "subspawn-win32/lib" -I "subspawn/lib" -r 'subspawn' -r 'subspawn/replace-pty' -e 'm,s =PTY.open; p [m,s]; pid,j = SubSpawn.spawn(["cmd"], pty: s); sleep 5; m << "echo yes\n\r\nexit\r\n"; m.flush; p pid, j; p m.read(5); p Process.wait(pid); puts "done"'
require 'java'
h = java.util.HashMap.new
h["one"] = 2
def foo(one:)
p one
end
foo(h)
bidet
a = case [0, 1, 2, 3, 4]
in [*pre, 2, *post]
[pre, post]
else
false
end
p a
java.lang.Thread.State: RUNNABLE
at org.jruby.RubyString.makeShared(RubyString.java:862)
at org.jruby.RubyString.multibyteSubstr19(RubyString.java:3745)
at org.jruby.RubyString.substr19(RubyString.java:3696)
at org.jruby.RubyString.op_aref(RubyString.java:3839)
at org.jruby.RubyString.op_aref(RubyString.java:3798)
at org.jruby.RubyString$INVOKER$i$op_aref.call(RubyString$INVOKER$i$op_aref.gen)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:173)
at home.enebo.work.jruby.lib.ruby.stdlib.rdoc.markdown.invokeOther5:\=\{\}(/home/enebo/work/jruby/lib/ruby/stdlib/rdoc/markdown.rb:362)
at home.enebo.work.jruby.lib.ruby.stdlib.rdoc.markdown.RUBY$method$get_byte$0(/home/enebo/work/jruby/lib/ruby/stdlib/rdoc/markdown.rb:362)
java.lang.Exception
at org.jruby.runtime.BlockBody.prepareArgumentsForCall(BlockBody.java:268)
at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:66)
at org.jruby.runtime.Block.call(Block.java:143)
at org.jruby.RubyProc.call(RubyProc.java:291)
at org.jruby.RubyProc$INVOKER$i$call.call(RubyProc$INVOKER$i$call.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrOneOrNBlock.call(JavaMethod.java:354)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:172)
at org.jruby.RubyEnumerable$ChunkedBlockCallback.lambda$call$0(RubyEnumerable.java:2088)
at org.jruby.runtime.BlockCallback.call(BlockCallback.java:58)
@enebo
enebo / lol.c
Created February 22, 2021 21:34
int foo() {
int i;
i = 42;
}
int bar() {
int i;
return i;
}
h = java.util.HashMap.new
h.put(1, 2)
class X
def blah(*args, **kwargs)
p args, **kwargs
args
end
end
class Y < X
def blah(*args)
diff --git a/core/src/main/java/org/jruby/ir/instructions/CallBase.java b/core/src/main/java/org/jruby/ir/instructions/CallBase.java
index 8ea4f58bae..20ff6865a8 100644
--- a/core/src/main/java/org/jruby/ir/instructions/CallBase.java
+++ b/core/src/main/java/org/jruby/ir/instructions/CallBase.java
@@ -549,7 +549,7 @@ public abstract class CallBase extends NOperandInstr implements ClosureAccepting
return callSite.call(context, self, object, values, preparedBlock);
}
- protected IRubyObject[] prepareArguments(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope dynamicScope, Object[] temp) {
+ public IRubyObject[] prepareArguments(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope dynamicScope, Object[] temp) {