Skip to content

Instantly share code, notes, and snippets.

View headius's full-sized avatar

Charles Oliver Nutter headius

View GitHub Profile
@headius
headius / jruby_9.3.4.0_notes.md
Created March 23, 2022 16:06
JRuby 9.3.4.0 release notes

Thanks to our contributors this cycle for helping to improve compatibility: [@ahorek], [@byteit101], [@k77ch7]

Ruby Compatibility

  • define_singleton_method now always uses public visibility. This simplifies its implementation and eliminates warnings when aliasing it, as in the ostruct gem. ([ruby/ostruct#40], [#7031], [#7055])

Java Integration

--- lib/tmpdir.rb 2022-01-26 15:27:27.000000000 -0600
+++ ../jruby/lib/ruby/stdlib/tmpdir.rb 2021-10-27 14:50:07.000000000 -0500
@@ -1,20 +1,20 @@
# frozen_string_literal: true
#
# tmpdir - retrieve temporary directory path
#
# $Id$
#
--- lib/resolv.rb 2022-01-26 15:27:26.000000000 -0600
+++ ../jruby/lib/ruby/stdlib/resolv.rb 2021-10-27 14:50:07.000000000 -0500
@@ -29,20 +29,24 @@
# p ress.map { |r| [r.exchange.to_s, r.preference] }
# end
#
#
# == Bugs
#
# * NIS is not supported.
@headius
headius / pickjdk.bash
Created January 25, 2022 16:18
pickjdk: JDK switcher for MacOS
#!/bin/bash
#
# Provides a function that allows you to choose a JDK. Just set the environment
# variable JDKS_ROOT to the directory containing multiple versions of the JDK
# and the function will prompt you to select one. JAVA_HOME and PATH will be cleaned
# up and set appropriately.
# Usage:
# Include in .profile or .bashrc or source at login to get 'pickjdk' command.
# 'pickjdk' alone to bring up a menu of installed JDKs on OS X. Select one.
$ jdeps --module-path lib/modules/:lib/jzlib.jar:lib/ant.jar core/target/jruby-base-9.3.0.0-SNAPSHOT.jar
org.jruby.base
[file:///Users/headius/projects/jruby/lib/modules/org.jruby.jruby-base-9.3.0.0-SNAPSHOT.jar]
requires ant
requires com.headius.backport9
requires com.headius.invokebinder
requires com.headius.options
requires java.base
requires static java.compiler
requires java.management
@headius
headius / chadguac.md
Created May 7, 2021 21:34
Chad's Award Winning Guac

Chad's Guacamole

  • 4 Avocados
  • 2 Limes
  • 6 or more Cloves of Fresh Garlic, unpeeled
  • 1 Small Onion (red or white)
  • 2 Roma Tomatoes, diced
  • 3/4 cup Distilled White Vinegar
  • 1 tbsp Fresh Cilantro (optional), chopped
require 'benchmark/ips'
puts RUBY_DESCRIPTION
array = [[[[[[[[[[[14]]]]]]]]]]]
Benchmark.ips do |x|
x.report('dig-01') {|i| while i>0; i-=1; array.dig(0); end }
x.report('dig-02') {|i| while i>0; i-=1; array.dig(0, 0); end }
x.report('dig-03') {|i| while i>0; i-=1; array.dig(0, 0, 0); end }
@headius
headius / gist:153c43133aafa6d7820bf00c6a68cb7b
Created March 23, 2021 21:06
jnr-ffi errors on darwin-aarch64
-------------------------------------------------------------------------------
Test set: jnr.ffi.VarargsTest
-------------------------------------------------------------------------------
Tests run: 3, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.224 sec <<< FAILURE!
testSizeT(jnr.ffi.VarargsTest) Time elapsed: 0.014 sec <<< FAILURE!
java.lang.AssertionError: expected:<5> but was:<10>
at org.junit.Assert.fail(Assert.java:89)
at org.junit.Assert.failNotEquals(Assert.java:835)
at org.junit.Assert.assertEquals(Assert.java:647)
at org.junit.Assert.assertEquals(Assert.java:633)
From 0083ab83b69cc57c931ee7e9c261a3c3ce5d4aaa Mon Sep 17 00:00:00 2001
From: Charles Oliver Nutter <headius@headius.com>
Date: Fri, 19 Mar 2021 10:14:04 -0500
Subject: [PATCH] Use computeIfAbsent for safe ClassValue calc
---
.../jruby/javasupport/JavaSupportImpl.java | 29 +++++--------------
.../jruby/util/collections/ClassValue.java | 14 +++++----
.../collections/ClassValueCalculator.java | 8 -----
.../util/collections/Java7ClassValue.java | 5 ++--
@headius
headius / gist:14a50f446ab9d0f6976a231c8ec0f915
Created March 9, 2021 20:05
javac rejecting sibling class and package with same case-insensitive name
[DEBUG] Classpath:
[DEBUG] /Users/headius/projects/jruby/core/target/classes
[DEBUG] /Users/headius/.m2/repository/com/github/jnr/jnr-a64asm/1.0.0/jnr-a64asm-1.0.0.jar
[DEBUG] /Users/headius/.m2/repository/com/github/jnr/jnr-x86asm/1.0.2/jnr-x86asm-1.0.2.jar
[DEBUG] /Users/headius/.m2/repository/org/apache/ant/ant-launcher/1.9.8/ant-launcher-1.9.8.jar
[DEBUG] /Users/headius/.m2/repository/javax/annotation/javax.annotation-api/1.3.1/javax.annotation-api-1.3.1.jar
[DEBUG] Modulepath:
[DEBUG] /Users/headius/.m2/repository/org/ow2/asm/asm/9.1/asm-9.1.jar
[DEBUG] /Users/headius/.m2/repository/org/ow2/asm/asm-commons/9.1/asm-commons-9.1.jar
[DEBUG] /Users/headius/.m2/repository/org/ow2/asm/asm-tree/9.1/asm-tree-9.1.jar