Skip to content

Instantly share code, notes, and snippets.

c = -> a , b { a * b }.curry
c = c[2]
p c[4]
p c[8]
@ir-norn
ir-norn / ren.rb
Created November 26, 2015 13:23
連立方程式
def re ans1 , ans2 , af, bf
[*0..9].repeated_permutation(2).to_a.each do |x,y|
if af[x,y] == ans1
if bf[x,y] == ans2
print "x=",x , "_y=" , y
print "_af_" , af[x,y] , "_"
print "_bf_" , bf[x,y] , "\n"
return x,y
end
10.times do
p $mode = 1.-($mode || 0)
end
class Class
def check n
return n if n.instance_of? self
raise "object-type-error #{self}.#{__method__} #{n} == #{n.class}"
end
end
def func n
n * 2
end
@ir-norn
ir-norn / _sprite_task.rb
Last active November 12, 2015 08:00
dxruby sprite test
#coding:utf-8
require "dxruby"
Dir.chdir File.dirname(File.expand_path(__FILE__))
Window.width = 400
Window.height = 400
TASK = Object.new.extend Module.new{attr_accessor :scene , :scene_sys , :user,:user_shot,:enemy,:enemy_shot , :effect}
TASK.scene = []
TASK.scene_sys = []
TASK.effect = []
@ir-norn
ir-norn / repl.rb
Created November 10, 2015 15:49
short code
def repl s
(s=~/\(.*?(\(.*)\)/?s.sub($1,repl($1).to_s):s).scan(/\((.*?)\s(.*)\)/).last.last.split.map(&:to_i).inject *(eval"[$1=~/[a-z]/,:#{$1}].compact")
end
repl"(print (+ 8 9))"
puts
p repl"(* 8 9 5 5 5 5)"
repl"(p (* 59 5 (* 4 (/ 10 6))))"
@ir-norn
ir-norn / .md
Last active November 28, 2015 20:28
Enumerable#prev #chino_to_enum / count_lib_v2 / Fiber

info

  • Count_lib_v2  / prev peek
  • chino_to_enum  / prev

この三つは非常に低速 nextの数百倍~

この実装はpeekだけの速度を犠牲にした ( rewind の使用

@ir-norn
ir-norn / LoVA_data
Created November 5, 2015 10:10 — forked from 5l/LoVA_data
LoVAのボイスと画像URL一覧
順番はランダムです
自動で生成したので中には存在しないボイスのURLが存在します
アジ・ダハーカ
種族:魔種
画像URL:http://cache.lova.jp/servantdatabase/ver20150424/art/mcY_jSRUinw-_art.jpg
ボイスURL:http://cache.lova.jp/servantdatabase/ver20150424/voice/mcY_jSRUinw-_voice.mp3
データインポートURL:http://lova.jp/servantdatabase/?key=2mBcZ.ELWiNKUszF38h36BDELYHt5OUhI_xaqJbN0BJqusAh9l4HMR6Z8xCckDDafF66sOxJ5rzX4iMFWWOvfg--
コノハナサクヤ
@ir-norn
ir-norn / .md
Last active November 3, 2015 09:49
Ruby  BenchMark  /  2.2.0p0  vs  2.2.3p173

String Symbol 展開

@ir-norn
ir-norn / .md
Last active October 31, 2015 18:25
dxruby _ key save replay

リプレイ保存、再生 

データ圧縮は

MessagePack 、LZMA

このあたりを試す