Skip to content

Instantly share code, notes, and snippets.

Thomas E Enebo enebo

Block or report user

Report or block enebo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View redmine_jruby.md
  1. edit similar to: https://gist.github.com/enebo/94d39d94dabcfe9fadbb1aa5ac050528 (appropriate per which db you end up using)
  2. cp config/database.yml.example config/database.yml
  3. edit config/database.yml for db
  4. jruby -S bundle install --without development test rmagick
  5. jruby -S bundler exec rake generate_secret_token
  6. jruby -S bundler exec rake db:migrate RAILS_ENV="production"
  7. RAILS_ENV=production jruby -S rake db:fixtures:load

= Postgres Database Configuration

View gsub1.rb
# coding: utf-8
require 'benchmark/ips'
STR1 = 'white chocolate あand white xmas and white bread'
STR2 = 'a1'
STR3 = 'dog'
REGEXP2 = /\d/
REGEXP3 = /\w+/
View dddd.txt
jruby -Xcompile.invokedynamic -Xjit.threshold=0 -Xjit.logging -Xjit.logging.verbose -e 'def foo; end; foo'
2019-11-01T15:54:39.359-05:00 [main] ERROR Ruby : failed to compile target script: -e
org.jruby.compiler.NotCompilableException: failed to compile script -e
at org.jruby.ir.Compiler.execute(Compiler.java:61)
at org.jruby.ir.Compiler.execute(Compiler.java:30)
at org.jruby.ir.IRTranslator.execute(IRTranslator.java:42)
at org.jruby.Ruby.tryCompile(Ruby.java:838)
at org.jruby.Ruby.precompileCLI(Ruby.java:807)
at org.jruby.Ruby.runNormally(Ruby.java:769)
at org.jruby.Ruby.runNormally(Ruby.java:798)
View gist:25a2fa8cef7dbab0d4edb30a98a862e5
= BEFORE =
jruby ../snippets/unpack1.rb
Ignoring bcrypt-ruby-3.0.0-java because its extensions are not built. Try: gem pristine bcrypt-ruby --version 3.0.0
Warming up --------------------------------------
unpack m short 6.479k i/100ms
unpack1 m short 9.154k i/100ms
unpack m long 22.000 i/100ms
unpack1 m long 23.000 i/100ms
Calculating -------------------------------------
View gist:50d46479c1209b41f56d2076353d7838
int next = safeGet(format);
if (next == 'm') {
byte[] src = encodedString.getUnsafeBytes();
int length = src.length*3/4;
byte[] dest = new byte[length];
int index = Base64.getDecoder().decode(src, dest);
return runtime.newArray(runtime.newString(new ByteList(dest, 0, index, ASCII, false)));
}
View works.rb
p Java::Util
module Java
module Java
class Foo
end
module Util
class Bar
end
class HashMap
Foo = 1
View err.rb
p Java::Util
module Java
module Util
class Foo
end
end
end
View aaaa.rb
it 'includes :line event when event is not specified' do
event_name = nil
TracePoint.new() { |tp| $stderr.puts "EN: #{tp.event}"; event_name = tp.event }.enable do
$stderr.puts "AAAAAAAA.1 #{event_name}"
event_name.should equal(:line)
event_name = nil
TracePointSpec.test
$stderr.puts "AAAAAAAA.2 #{event_name}"
event_name.should equal(:line)
View a.rb
TracePoint.trace { |tp| puts tp.inspect } # 1
class Foo
def to_ary
proc { [1,2] }.call
end
end
proc { |a,| }.call(Foo.new)
View a.diff
diff --git a/Rakefile b/Rakefile
index 2bd2499f..9e36cb96 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,3 +1,29 @@
+# Common usage
+#
+# rake build:adapters - to build all specific adapter gems and the base gem
+# rake release:do - build:adapters + git tag + push gems
+#
You can’t perform that action at this time.