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 | |
# 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
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
# | |
# webp jpg | |
# フォルダが存在すればtrue | |
if system"copy *.* tmp\\*.*" | |
system"nconvert -D -out jpeg *.jpg" | |
Dir["*.*"].each do|m| | |
next if File.extname(m) == ".rb" # rb script だけ除外 | |
# _1 がつくのでそれをrename | |
b = File.basename(m, '.*') |
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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> | |
<title></title> | |
</head> | |
<body> | |
<style><!-- | |
div { background: #bbb; | |
height : 50px; | |
width : 50px; |
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
<style><!-- | |
div.body { display:none } | |
div.entry_border { opacity:0.3 } | |
article.page { display:none } | |
--></style> | |
<script><!-- | |
$(document).ready(function() { | |
/* $('body').fadeIn(1400); */ |
OlderNewer