Skip to content

Instantly share code, notes, and snippets.

View olleolleolle's full-sized avatar
🙌
In sunny Malmö in Sweden 🌞

Olle Jonsson olleolleolle

🙌
In sunny Malmö in Sweden 🌞
View GitHub Profile
module Opener
module Core
module Syslog
def self.enabled?
false
end
end
end
end
@olleolleolle
olleolleolle / mri-vs-jruby-on-scan-with-x.md
Last active October 30, 2017 15:38
Swedish characters are hard to pick up graphemes for

MRI

2.4.2 :038 > 'åäöÅÄÖ'.unicode_normalize(:nfd).scan(/\X/)
 => ["å", "ä", "ö", "Å", "Ä", "Ö"]
 

JRuby

263,264c263
< # Net::HTTP.start(uri.host, uri.port,
< # :use_ssl => uri.scheme == 'https') do |http|
---
> # Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
266d264
< #
269a268,274
> # Or if you simply want to make a GET request, you may pass in an URI
> # object that has a HTTPS URL. Net::HTTP automatically turn on TLS
@olleolleolle
olleolleolle / commutative_reducer.rb
Created February 25, 2017 18:55
Example Celluloid program which used to crash JRuby. See https://github.com/celluloid/celluloid/issues/677
require "rubygems"
require "celluloid"
require "pry"
module Enumerable
class ComutativeReducerActor
include Celluloid
def initialize(enumerable, reducer)
@enumerable = enumerable
@olleolleolle
olleolleolle / test-issue-47.rb
Created February 20, 2017 11:21
Test script for issue 47
#!/usr/bin/env ruby -w
# Implementation
BACKTRACE_REGEX = /^(.+?):(\d+)(?::in `(.+?)')?$/.freeze
def strip_load_path path
prefix = $:
.map(&:to_s)
.select { |s| path.start_with?(s) }
GEM
remote: https://rubygems.org/
specs:
bcrypt (3.1.11)
diff-lcs (1.2.5)
rake (12.0.0)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
@olleolleolle
olleolleolle / bisect-to-yard.sh
Created December 6, 2016 22:12
Learning to run bisect on the JRuby codebase
#!/bin/bash
# Script to bisect to the right JRuby
#
# 9.1.2.0 works
# 9.1.3.0 does not work
#
# https://git-scm.com/docs/git-bisect
#
# Build JRuby, bundle install, then rspec
#
#!/usr/bin/env ruby -G --dev
$: << __dir__
require 'java'
require 'jdbc/postgres'
require 'sequel'
require 'sequel/adapters/jdbc'
require 'thread'
# Pre-requisite: Set up a failing "SQL server" to not connect to
#
@olleolleolle
olleolleolle / speculation-on-connect-in-jdbc
Created November 14, 2016 09:06
Is this a bug, I don't know yet.
Using Sequel with the jdbc adapter, I got a:
```
NoMethodError: undefined method `message=' for #<Java::JavaSql::SQLException:0x37daf0d>
```
on the line [sequel-4.38.0/lib/sequel/adapters/jdbc.rb:227:in `connect'](https://github.com/jeremyevans/sequel/blob/master/lib/sequel/adapters/jdbc.rb#L225)
If the re-caught error, `e2`, `is_a?(Java::JavaSql::SQLException)`, could it do something else?
@olleolleolle
olleolleolle / centralen.txt
Last active September 13, 2016 08:28
Elevatorfører - Centralen
en verden
stablet i dobletter
med referater til kopi
organiseret i jatekker
med handleplaner indeni
alt ---
tvunget til fængsel uden dom
i en fortagende raison-d'etre
støbt i rener af beton