This file contains hidden or 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
| jruby 10.0.5.0 (3.4.5) 2026-04-06 5db1ba72f3 Java HotSpot(TM) 64-Bit Server VM 21.0.9+7-LTS-338 on 21.0.9+7-LTS-338 +indy +jit [x86_64-linux] | |
| ----- single-threaded ----- | |
| Rehearsal --------------------------------------------------------------------------- | |
| Supplier Optional#orElseGet 12.350000 0.440000 12.790000 ( 6.153782) | |
| Function Optional#map 10.320000 0.300000 10.620000 ( 6.399324) | |
| Predicate Optional#filter 9.130000 0.220000 9.350000 ( 5.944928) | |
| IntConsumer OptionalInt#ifPresent 9.010000 0.230000 9.240000 ( 5.622397) | |
| DoubleSupplier OptionalDouble#orElseGet 9.990000 0.180000 10.170000 ( 5.743960) | |
| BiFunction Map#compute 9.050000 0.110000 9.160000 ( 5.596288) | |
| BiFunction Map#computeIfPresent 8.960000 0.150000 9.110000 ( 5.528440) |
This file contains hidden or 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
| var simpleFormatRE1 = /\r\n?/g; | |
| var simpleFormatRE2 = /\n\n+/g; | |
| var simpleFormatRE3 = /([^\n]\n)(?=[^\n])/g; | |
| function simpleFormat(str) { | |
| var fstr = str; | |
| fstr = fstr.replace(simpleFormatRE1, "\n") // \r\n and \r -> \n | |
| fstr = fstr.replace(simpleFormatRE2, "</p>\n\n<p>") // 2+ newline -> paragraph | |
| fstr = fstr.replace(simpleFormatRE3, "$1<br/>") // 1 newline -> br | |
| fstr = "<p>" + fstr + "</p>"; | |
| return fstr; |
This file contains hidden or 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
| # | |
| # Recurring Job using Delayed::Job | |
| # | |
| # Setup Your job the "plain-old" DJ (perform) way, include this module | |
| # and Your handler will re-schedule itself every time it succeeds. | |
| # | |
| # Sample : | |
| # | |
| # class MyJob | |
| # include Delayed::ScheduledJob |
This file contains hidden or 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 'jruby/profiler' | |
| profile_data = JRuby::Profiler.profile do | |
| # code to be profiled.... | |
| end | |
| # print data in flat format to STDOUT : | |
| profile_printer = JRuby::Profiler::FlatProfilePrinter.new(profile_data) | |
| profile_printer.printProfile(STDOUT) |
This file contains hidden or 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
| /** | |
| * Google Translate automatic for the people ! | |
| * | |
| * - visit http://translate.google.com make sure instant translation is on | |
| * - set source and target languages and open firebug | |
| * - copy your JSON translation object in (string key/value pairs) : | |
| * var input = { "hello.world": "Hello World !", ... }; | |
| * - make sure non of your values to be translated end with '...' ! | |
| * - declare and output object where translations will be stored : | |
| * var output = {}; |
This file contains hidden or 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
| /** | |
| * $.parseParams - parse query string paramaters into an object. | |
| */ | |
| (function($) { | |
| var re = /([^&=]+)=?([^&]*)/g; | |
| var decodeRE = /\+/g; // Regex for replacing addition symbol with a space | |
| var decode = function (str) {return decodeURIComponent( str.replace(decodeRE, " ") );}; | |
| $.parseParams = function(query) { | |
| var params = {}, e; | |
| while ( e = re.exec(query) ) { |
This file contains hidden or 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
| # Allows for an #override annotation for your methods. | |
| # Thus might help you during refactoring (method renaming) to assure methods | |
| # expected to call a super will fail early during loading instead of runtime. | |
| # | |
| # Sample : | |
| # | |
| # class Message | |
| # extend Override | |
| # | |
| # def do_send; end |
This file contains hidden or 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 'active_record/log_subscriber' | |
| class SlowQueryLog < ActiveSupport::LogSubscriber | |
| if Rails.configuration.respond_to?(:slow_query_log_threshold_in_ms) | |
| if @@threshold = Rails.configuration.slow_query_log_threshold_in_ms | |
| @@threshold = @@threshold.to_i == 0 ? nil : @@threshold.to_i | |
| end | |
| else | |
| @@threshold = nil |
This file contains hidden or 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
| /** | |
| * jsUnity Universal JavaScript Testing Framework v0.6 | |
| * http://jsunity.com/ | |
| * | |
| * Copyright (c) 2009 Ates Goral | |
| * Licensed under the MIT license. | |
| * http://www.opensource.org/licenses/mit-license.php | |
| * | |
| * Copyright (c) 2010 Karol Bucek - FBJS compatible |
This file contains hidden or 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
| # reproducer for https://github.com/jruby/jruby-openssl/issues/236 | |
| # If a certificate has two trust paths, jruby doesn't prioritize using non expired certificates, while CRuby (openssl 1.1.1+) does | |
| # In this reproducer we have a leaf certificate with two possible chains: | |
| # a) leaf -> intermediate cert A -> ISRG Root X1 cross-signed by (expired) DST ROOT CA X3 -> (expired) DST ROOT CA X3 | |
| # b) leaf -> intermediate cert B -> ISRG Root X1 | |
| # JRuby will produce chain a) causing an error, while CRuby produces a valid chain b) | |
| require 'openssl' | |
| require 'net/http' | |
| def cert_from_url(url) |
NewerOlder