- MuscleMixin
- Rubyと筋肉を作り込む話
- PicoRubyとマイコンでトレーニング計測装置を作る
- LEDで速度と加速度を示す
- ダンベルを挙げる速度と重量が相関する
- 速度を知りたい
- 機器は大がかりであったりプロ向けであったりする
- 自作する
- 速度を知りたい
- エンジニアリング
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'builder' | |
require 'json' | |
list = JSON.load_file('list.json') | |
builder = Builder::XmlMarkup.new | |
builder.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8" | |
xml = builder.opml(version: '1.0') do |opml| | |
opml.head do |head| | |
head.title("This is the title") | |
head.dateCreated(Time.now) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Michael Abrash", | |
"Scott Adams (game designer)", | |
"Tarn Adams", | |
"Leonard Adleman", | |
"Alfred Aho", | |
"Andrei Alexandrescu", | |
"Paul Allen", | |
"Eric Allman", | |
"Marc Andreessen", | |
"Jeremy Ashkenas", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'syntax_tree' | |
class RSpecEnvironment | |
def initialize | |
@contexts = [] | |
@results = [] | |
end | |
def klass(k) | |
@contexts << k |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyStringScanner | |
class ScanError < StandardError; end | |
attr_reader :string, :captures | |
attr_accessor :pos | |
def initialize(string, _obsolete = false, fixed_anchor: false) | |
@string = string | |
@fixed_anchor = fixed_anchor | |
@pos = 0 | |
@previous_pos = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.included(base) | |
base.instance_variable_set(:@count, 0) unless base.instance_variable_defined?(:@count) | |
base.instance_variable_set(:@count, base.instance_variable_get(:@count) + 1) | |
puts base.name if base.instance_variable_get(:@count) > 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
def transform(&block) | |
new_hash = {} | |
each_pair do |key, value| | |
rtn = block.call(key, value) | |
case rtn | |
in nil | true then new_hash[key] = value | |
in false then next | |
in Array[[_, _], *] | |
rtn.each do |k, v| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAPPING = { | |
a: 1, | |
b: 2, | |
c: 3, | |
d: 4, | |
e: 5, | |
f: 6, | |
}.freeze | |
def method1(key) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Kernel | |
def ice(key, value, on: Object) | |
if on.instance_methods.include?(key.to_sym) | |
prev = on.instance_method(key) | |
on.define_method key do | |
on.remove_method key | |
on.define_method(key, prev) | |
return value | |
end | |
else |
NewerOlder