Skip to content

Instantly share code, notes, and snippets.

View duckinator's full-sized avatar

Ellen Marie Dash duckinator

View GitHub Profile
puts DATA.read #=> prints "hi\n"
__END__
hi
@duckinator
duckinator / bashrc.part.sh
Created October 21, 2016 08:07
Hack to make Bash on Windows auto-start zsh. Prepend to .bashrc.
if [ "$SHLVL" == "1" ]; then
exec zsh
fi
type Op = Fn(u16, u16);
fn op_mov(one: u16, two: u16) {
}
fn op_add(one: u16, two: u16) {
}
fn op_nand(one: u16, two: u16) {
}
type Op = Fn(u16, u16);
fn op_mov(one: u16, two: u16) {
}
fn op_add(one: u16, two: u16) {
}
fn op_nand(one: u16, two: u16) {
}
let mut methods = std::collections::HashMap::new();
methods.insert(0b0000, mov);
methods.insert(0b0001, add);
methods.insert(0b0010, nand);
// ...
fn execute(opcode: u8, operand1: u8, operand2: u8) {
methods.get(opcode)(operand1, operand2)
}
methods = {
0b0000 => :mov,
0b0001 => :add,
0b0010 => :nand,
# ...
}
def execute(opcode, operand1, operand2)
send(methods[opcode], operand1, operand2)
end
C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:675:in `method_missing': undefined method `its' for RSpec::ExampleGroups::GithubConfiguration:Class (NoMethodError)
from C:/Users/Marie/dev/ruby/piotrmurach/github/spec/github/configuration_spec.rb:11:in `block in <top (required)>'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:385:in `module_exec'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:385:in `subclass'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:255:in `block in define_example_group_method'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/dsl.rb:43:in `block in expose_example_group_alias'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/dsl.rb:82:in `block (2 levels) in expose_example_group_alias_globally'
from C:/Users/Marie/dev/ruby/piotr
C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:675:in `method_missing': undefined method `its' for RSpec::ExampleGroups::GithubConfiguration:Class (NoMethodError)
from C:/Users/Marie/dev/ruby/piotrmurach/github/spec/github/configuration_spec.rb:11:in `block in <top (required)>'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:385:in `module_exec'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:385:in `subclass'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:255:in `block in define_example_group_method'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/dsl.rb:43:in `block in expose_example_group_alias'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/dsl.rb:82:in `block (2 levels) in expose_example_group_alias_globally'
from C:/Users/Marie/dev/ruby/piotr
C:/Users/Marie/dev/ruby/piotrmurach/github/spec/spec_helper.rb:34:in `block in <top (required)>': undefined method `color_enabed=' for #<RSpec::Core::Configuration:0x00000002ea5ec8> (NoMethodError)
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core.rb:97:in `configure'
from C:/Users/Marie/dev/ruby/piotrmurach/github/spec/spec_helper.rb:31:in `<top (required)>'
from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/Users/Marie/dev/ruby/piotrmurach/github/spec/github/api/arguments/parse_spec.rb:3:in `<top (required)>'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1361:in `load'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1361:in `block in load_spec_fles'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.
#!/usr/bin/env ruby
require 'spinny/utilities'
=begin
def foo
def foo
1
end