This file contains 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
#coding:utf-8 | |
require "watir" | |
nya = [ | |
"スレッドタイトル1" , "内容1" , | |
"スレッドタイトル2" , "内容2" , | |
].*(10) | |
time = 1024 | |
agent = Watir::Browser.new :ie |
This file contains 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
#coding:utf-8 | |
# 2015 09 24 Req | |
require"dxruby" | |
class O | |
attr_accessor :x,:y,:d,:f,:task | |
def initialize h = {} | |
@x = h[:x] | |
@y = h[:y] | |
@d = h[:d] |
This file contains 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 Task | |
def initialize | |
@func =->{yield self} | |
end | |
def update | |
@func.call | |
end | |
end |
This file contains 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
#coding:utf-8 | |
# https://ja.m.wikipedia.org/wiki/Help:%E3%83%9A%E3%83%BC%E3%82%B8%E3%81%AE%E7%B7%A8%E9%9B%86 | |
text=<<TEXT | |
:コロンで始まる行は字下げされます。改行しない限り、同じ深さで表示されます。 | |
::コロンを追加すると、さらに深く字下げされます。 | |
::同じ個数のコロンを使うと、同じ深さの字下げになります。 | |
:::あまり深くなり過ぎると、 | |
::::読みづらくなるかもしれません。 | |
::Sample | |
:::文章 |
This file contains 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 "observer" | |
require "dxruby" | |
class Observer | |
include Observable | |
end | |
class O | |
attr_accessor :x , :y , :d , :func | |
def initialize x , y , d , func |
This file contains 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
# coding : utf-8 | |
require "dxruby" | |
def move x , y , s , a | |
x += (s * Math::cos(a * Math::PI/180 )) | |
y += (s * Math::sin(a * Math::PI/180 )) | |
[x , y , s , a] | |
end | |
def DegToRad x |
This file contains 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 Rationalize | |
refine Fixnum do | |
def /(other) | |
quo(other) | |
end | |
end | |
end | |
p 1 / 2 |
This file contains 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 "Fiber" | |
class Enum_Generator | |
def initialize re , method | |
@f = Fiber.new do | |
re.__send__(method) do | n | | |
Fiber.yield n | |
end | |
end | |
end |
This file contains 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
nums = [1,2,3,4,5,1,2,2,3] | |
p nums.itself { |s| s.inject(:+) / s.size.to_f } # => 2.5555555555555554 | |
p nums.inject(:+) / nums.size.to_f # => 2.5555555555555554 | |
p nums.group_by(&:itself) # => {1=>[1, 1], 2=>[2, 2, 2], 3=>[3, 3], 4=>[4], 5=>[5]} |
This file contains 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
#coding:utf-8 | |
# | |
# 2015 10 02 | |
# watir_sample.rb | |
# https://gist.github.com/ir-norn/e1968bb305aa8d03e1e5 | |
# | |
require "watir" | |
require "kconv" | |
require "open-uri" |
OlderNewer