Skip to content

Instantly share code, notes, and snippets.

@ir-norn
ir-norn / watir_sample.rb
Last active October 22, 2015 12:02
スレたて
#coding:utf-8
require "watir"
nya = [
"スレッドタイトル1" , "内容1" ,
"スレッドタイトル2" , "内容2" ,
].*(10)
time = 1024
agent = Watir::Browser.new :ie
@ir-norn
ir-norn / watir_sample2.rb
Last active October 22, 2015 12:02
2cht
#coding:utf-8
#
# 2015 10 02
# watir_sample.rb
# https://gist.github.com/ir-norn/e1968bb305aa8d03e1e5
#
require "watir"
require "kconv"
require "open-uri"
@ir-norn
ir-norn / init.coffee
Last active October 22, 2015 18:19
atom editor
atom.commands.add 'atom-text-editor',
'user:paste-results-as-comment': ->
editor = atom.workspace.getActiveTextEditor()
editorElement = atom.views.getView(editor)
atom.commands.dispatch editorElement, 'script:copy-run-results'
text = atom.clipboard.read()
editor.insertText(text.replace(/\[Finished.*\]/gm, ''))
@ir-norn
ir-norn / tree_task_array.rb
Last active October 27, 2015 09:54
tree_taskのハッシュの最終version これ以降は多分リストで書く //// tree_task_array.rbはリスト
module Merkle_tree_m
include Tree_task_search_m
attr_accessor :sym , :up , :func , :task , :n
# TREE TASK SYSTEM ADD variables
attr_accessor :Flandoll , :Scarlet # Message_Q / Scene間のデータ移動
def initialize hs = Hash.new , &block
@sym = hs[:sym]
@up = hs[:up]
@func = block
0008,PanelHideAll
0009,PanelHideAll
0021,ViewZoomInCurPos
0022,ViewZoomOutCurPos
0023,ViewRotateR
0024,ViewHome
002d,ViewRotateReset
002e,ViewRotateL
0030,Undo
0031,BrushSizeDown
# Fiberによるイベントプロシージャの実装(簡易版)
### コンストラクタ
@ev = event_proc
def event_proc
Fiber.new do loop do
code , *arg = Fiber.yield
case code
when :VK_0
p :test
@ir-norn
ir-norn / moon_count.html
Last active October 28, 2015 13:21
blog / Jekyllのみで月別記事をカウントする試み
<script type="text/javascript" language="javascript"><!--
var count = function(num) {
hs = new Array();
return {
getNum: function( key ) {
if( !hs[key] ){ hs[key] = 0; }
return hs[key]++;
},
Num: function(key) {
@ir-norn
ir-norn / koron.rb
Last active October 28, 2015 13:24
段落のタグddをメタするやつ
#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
:::文章
# https://bugs.ruby-lang.org/issues/8987
module Kernel
def λ expr
eval("->x{ #{expr} x}")
end
end
p [1, 2, 3, 4].map(&λ("4+")) #=> [5, 6, 7, 8]
@ir-norn
ir-norn / Queue.rb
Last active October 31, 2015 11:17
Queue / forwardable delegate
require 'forwardable'
class MyQueue
extend Forwardable
def initialize
@queue = []
end
def_delegators :@queue , :push, :<<, :shift,
:first, :last ,:size , :clear, :to_a