Skip to content

Instantly share code, notes, and snippets.

View takkanm's full-sized avatar

Mitsutaka Mimura takkanm

  • Tokyo, Japan
View GitHub Profile
autoload 'B', './b.rb'
class Base
def self.nop(c); end
end
class A
class InnerA < Base
nop B::InnerA
end
irb(main):001:0> module I
irb(main):002:1> include
irb(main):003:1> end
=> I
irb(main):004:0> module P
irb(main):005:1> prepend
irb(main):006:1> end
=> P
irb(main):007:0> module E
irb(main):008:1> extend
#define SIGNAL_5PIN 2
#define SIGNAL_6PIN 1
#define POWER_PIN 3
#define MOTOR_POWER 255
#define MOVE_TIME 20000
#define STOP_TIME 1000
void setup() {
pinMode(SIGNAL_5PIN, OUTPUT);
pinMode(SIGNAL_6PIN, OUTPUT);
└> cargo outdate
error: no such subcommand
Did you mean `update`?
require 'benchmark'
module Foo
def foo;end
end
times = 1_000_000
Benchmark.bm 30 do |r|
r.report 'none' do
require 'benchmark'
module Foo
end
times = 1_000_000
Benchmark.bm 30 do |r|
r.report 'extend' do
times.times do
module Foo
def foo
super
p :foo
end
end
module Fuga
def foo
super
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
require 'timeout'
pid = Process.spawn('sleep', '10')
puts Time.now
begin
Timeout.timeout(1) {
Process.waitpid(pid)
}
rescue => e
p e
source "https://rubygems.org"
gem 'rspec'