I thought I would document my setup, since it's somewhat non-standard but working quite well for me.
- Install major Ruby versions at their latest patch release
- Allow to switch between them seamlessly
- Use chruby
- Encourage bundler usage
Add Graal JIT Compilation to Your JVM Language in 5 Steps, A Tutorial http://stefan-marr.de/2015/11/add-graal-jit-compilation-to-your-jvm-language-in-5-easy-steps-step-1/
The SimpleLanguage, an example of using Truffle with great JavaDocs. It is the officle getting-started project: https://github.com/graalvm/simplelanguage
Truffle Tutorial, Christan Wimmer, PLDI 2016, 3h recording https://youtu.be/FJY96_6Y3a4 Slides
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require 'json' | |
require 'optionparser' | |
KEYWORDS = %i[color metadata glow_in_the_dark coats].freeze | |
DEFAULTS = {coats: 3, glow_in_the_dark: true}.freeze |
I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").
Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):
# minitest/spec.rb
module MiniTest::Expectations
class ZCombinator | |
def initialize improver | |
@improver = improver | |
end | |
def call gen | |
eat_its_tail(gen).( | |
->(gen) { @improver.(applicatively_eat_its_tail gen) } | |
).(gen) | |
end |
map = -> f { | |
-> rf { | |
-> acc, elem { | |
rf[acc, f[elem]] | |
} | |
} | |
} | |
square = -> n { n**2 } | |
add = -> acc, n { acc + n } |
require 'fiddle' | |
class GVL | |
handle = Fiddle::Handle::DEFAULT | |
address = handle['rb_thread_blocking_region'] | |
func = Fiddle::Function.new address, [Fiddle::TYPE_VOIDP, | |
Fiddle::TYPE_VOIDP, | |
Fiddle::TYPE_VOIDP, | |
Fiddle::TYPE_VOIDP], Fiddle::TYPE_VOIDP |
As configured in my dotfiles.
start new:
tmux
start new with session name:
#!/usr/bin/env ruby | |
class Time | |
WEEKDAYS = %w[ Sunday Monday Tuesday Wednesday Thursday Friday Saturday ] | |
def day_before_yesterday | |
xday -2 | |
end | |
def yesterday |