Skip to content

Instantly share code, notes, and snippets.

View brixen's full-sized avatar

Brian Shirai brixen

View GitHub Profile
@sshao
sshao / points.md
Last active August 29, 2015 14:14
writing a language on the rbx vm
  • Identifying and explaining general concepts
    • scopes, bindings, environments
    • the background context behind 'running' a file/script/method
  • Compiler stages:
    • how they're organized and how they're chained
    • how to define the first/last stages. Does the first stage have to be the parser? (I tried to implement a 'lexer' stage before then, and couldn't figure out how)
  • Initializing the environment (things like initializing heap size/space) before compilation or execution
  • A high-level overview of how code -> s-expressions -> AST/AST nodes -> bytecode
@pd
pd / 00-symbol-vs-string-equality.rb
Created January 27, 2015 00:52
rbx -v == rubinius 2.5.0.n24 (2.1.0 af7eb1b4 2015-01-24 3.5.0 JI) [x86_64-darwin14.0.0]
require 'benchmark/ips'
SYM = :magic_key
MYS = :key_magic
STR = 'magic_key'
RTS = 'key_magic'
Benchmark.ips do |x|
x.config(time: 2, warmup: 1)
@nateberkopec
nateberkopec / gist:11dbcf0ee7f2c08450ea
Last active March 24, 2023 21:59
RubySpec is dead, long live RubySpec!

Last night, Brian Shirai unilaterally "ended" the RubySpec project, a sub-project of Rubinius (the alternative Ruby implementation which Brian was paid to work on full-time from 2007 to 2013). The blog post describing his reasons for "ending" the project led to a big discussion on Hacker News.

When a single, competing Ruby implementation tells that you its test suite is the One True Way, you should be skeptical. Charles Nutter, Ruby core committer and JRuby head honcho, spent a lot of time last night on Twitter talking to people about what this decision means. He's probably too busy and certainly too nice of a guy to write about what is a political issue in the Ruby community, so I'm going to do it on behalf of all the new or intermediate Rubyists out there that are confused by Brian's decision and what it me

@tak1n
tak1n / gist:1efaa234484d9300c2f0
Created December 30, 2014 17:43
Rubinius press
Sites which should know about rubinius 3.0 or mention it:
http://rubydaily.org/
http://rubyweekly.com/
http://www.rubyflow.com/
https://twitter.com/ruby_news
http://www.rubyinside.com/
http://www.rorcasts.com/
http://ruby5.envylabs.com/
http://www.sitepoint.com/ruby/
anonymous
anonymous / client.rb
Created December 2, 2014 22:13
class Report::Client
end
@brixen
brixen / gist:a5971cc930abd2ace163
Created December 1, 2014 23:37
Bundler --jobs > 1 on Rubinius
Bundler::GemspecError: Could not read gem at /Users/bshirai/.gem/rbx/2.1.0/cache/tzinfo-0.3.42.gem. It may be corrupted.
verify_entry: 3
wrong argument type Autoload (expected Module)
/Users/bshirai/.gem/rbx/2.1.0/gems/psych-2.0.6/lib/psych/class_loader.rb:53:in `resolve'
/Users/bshirai/.gem/rbx/2.1.0/gems/psych-2.0.6/lib/psych/class_loader.rb:45:in `find'
/Users/bshirai/.gem/rbx/2.1.0/gems/psych-2.0.6/lib/psych/class_loader.rb:27:in `load'
/Users/bshirai/.gem/rbx/2.1.0/gems/psych-2.0.6/lib/psych/visitors/to_ruby.rb:364:in `resolve_class'
/Users/bshirai/.gem/rbx/2.1.0/gems/psych-2.0.6/lib/psych/visitors/to_ruby.rb:207:in `visit_Psych_Nodes_Mapping'
/Users/bshirai/.gem/rbx/2.1.0/gems/psych-2.0.6/lib/psych/visitors/visitor.rb:15:in `visit'
/Users/bshirai/.gem/rbx/2.1.0/gems/psych-2.0.6/lib/psych/visitors/visitor.rb:5:in `accept'
@pd
pd / kw.rb
Last active August 29, 2015 14:10
rbx JIT/kwargs bug
def kw(a: 0); end
N = Integer(ARGV[0]) rescue 250_000
N.times { kw }
@ludyna
ludyna / dci_example.rb
Last active March 20, 2018 20:08
DCI (Data, Contexts, Interactions) paradigm example in Ruby
# DCI EXAMPLE IN RUBY (with some prototype elements)
# Blog post: https://www.ludyna.com/oleh/dci-example-in-ruby
#
# More info:
#
# Creator of MVC & DCI, Trygve Reenskaug: DCI: Re-thinking the foundations of
# object orientation and of programming
# http://vimeo.com/8235394
#
# James Coplien: Why DCI is the Right Architecture for Right Now
require 'rack'
require 'rubinius/profiler'
class RbxRackProfiler
def initialize(app)
@app = app
end
def call(env)
profiler = Rubinius::Profiler::Instrumenter.new
@Asmod4n
Asmod4n / speed_test.rb
Last active August 29, 2015 14:07
Speed differences in FFI memory management
require 'ffi'
require 'benchmark'
module LibC
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function :malloc, [:size_t], :pointer
attach_function :free, [:pointer], :void
end