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
desc 'Use ampersand in argument to system'
task :runbatch do |task_name, args|
command = 'tbat.bat && cmd /c start tbattwo.bat'
puts command
system command
end
# client.rb
require 'drb/drb'
DRb.start_service
remote_object = DRbObject.new_with_uri('druby://localhost:9999')
p remote_object.greet #=> 'Hello, world!'

This bug will track all NEWS items new in Ruby 2.5. This list is based off https://github.com/ruby/ruby/blob/trunk/NEWS.

Only changes relevant to JRuby are listed here. MRI-specific internal changes and features are not included.

NOTE: Pull requests should be done against the ruby-2.5 branch.

Language changes

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

@olleolleolle
olleolleolle / pre-commit.bat
Created June 11, 2010 07:40 — forked from jesperronn/pre-commit.bat
[useful] Subversion pre-commit hook for Windows machine
REM Subversion pre-commit hook for Windows machine
REM put this in your SVN repository folder /hooks/pre-commit.bat
REM we use it with svn version
REM http://stackoverflow.com/questions/869248/windows-pre-commit-hook-for-comment-length-subversion
@echo off
:: Stops commits that have empty log messages.
@echo off
setlocal
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)