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 'thread' | |
class File | |
# ファイルの更新を検知して、渡されたブロックを実行する | |
# 更新検知部分のコードは[ここ](http://ja.doukaku.org/comment/387/)のを丸パクリ | |
def self.watch(fileName, &function) | |
raise AugumentsError if(!File.exist?(fileName) || !function) | |
thread = Thread.new(fileName, function){ | _fileName, _function | | |
Thread.pass | |
last_mtime = File.mtime(_fileName) |
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
// ==UserScript== | |
// @name NicoLyricManager | |
// @namespace NicoLyricManager | |
// @description ニコ動の歌詞職人支援ツール | |
// @include http://www.nicovideo.jp/watch/* | |
// @include http://nine.nicovideo.jp/watch/* | |
// @excludes | |
// ==/UserScript== | |
(function(){ |
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 Array | |
def nindex(n) | |
p self | |
_index = self.index(n) | |
if _index.nil? | |
return [] | |
else | |
if _index == (self.size - 1) | |
return [_index] | |
else |
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
# 実現したいこと | |
puts "0" | |
# Golf | |
p 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
class Foo | |
@baz = 1 | |
@@bar = 2 | |
def self.baz; @baz; end | |
def self.baz=(n); @baz=n; end | |
def self.bar; @@bar; end | |
def self.bar=(n); @@bar=n; end | |
end | |
class Hoge < Foo |
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
#nil# Public local sketchbook | |
Desktop Templates log src | |
Documents Videos obj themes | |
Examples bin page-speed-images tmp | |
Firefox_wallpaper.png dev page-speed-javascript デスクトップ | |
Music hsptmp salasaga 編集中のドキュメント 1 | |
Pictures j602 server |
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.class_eval do | |
undef :allocate | |
end | |
begin | |
p Class.new | |
rescue => e | |
p e | |
end | |
# => <Class:0x*******> |
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 Object | |
def self_methods | |
methods.map{|m| | |
m=method(m.to_sym) | |
(m.owner == self.class ? m.name : nil ) | |
}.compact | |
end | |
end | |
p ''.methods.sort |
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
#!ruby path | |
ENV['GEM_HOME'] = "gem path" | |
require 'rubygems' | |
require 'cgi' | |
require 'RMagick' | |
require 'kconv' | |
print "Content-Type: text/html\n\n" |
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 Prototype | |
def new(member = {}, &block) | |
prototype(member || {}, self,&block) | |
end | |
def respond_to?(name) | |
return self if methods.include?(name.to_s) | |
__proto__ = @proto.respond_to?(name) | |
return __proto__ if __proto__ | |
false |