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
// listgmail.js | |
// View new mail list on Gmail. | |
// tomohiro nishimura ( tomohiro68__at__gmail.con ) | |
// | |
// 参考: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/gmail_biff.js | |
liberator.plugins.sbmCommentsViewer = (function(){ | |
liberator.commands.addUserCommand(['newmail', 'gnew'], 'List up new mail on gmail', | |
function(argument, special){ | |
setTimeout(function(){ |
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
# よくわからない習作 | |
me = Object.new | |
class << me | |
def get_bind | |
binding | |
end | |
def method_missing(name, *arg) |
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 'rubygems' | |
require 'RMagick' | |
1.upto 50 do |idx| | |
file = Dir["#{idx}/*.*"].first | |
p file | |
if file | |
img = Magick::ImageList.new(file).first | |
img.change_geometry('600x600') do |c, l, i| | |
i.resize! c, l |
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 Foo | |
class Bar | |
def class_object | |
self.class.to_s.split(/::/).inject(Object) do |c, name| | |
c.const_get(name) | |
end | |
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
#! /usr/bin/env ruby | |
require 'optparse' | |
require 'readline' | |
require 'yaml' | |
defname = 'lonst_session.yml' | |
Readline.vi_editing_mode | |
OptionParser.new do |opt| |
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 'forwardable' | |
# A singleton class inspired by Primer class in library | |
class Class | |
# We need that method like this become a bultin | |
def metaclass; class << self; self end end | |
end | |
class Foo |
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#meta..class | |
class Class | |
def method_missing(meth, *args) | |
unless meth.to_s =~ /\A((?:meta)+)class\z/ | |
super | |
end | |
level = $1.gsub(/meta/).count | |
level.times.inject(self) {|klass, _| class << klass; self 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
# This is a test/unit clone which was written to practice. | |
# | |
# Usage: | |
# | |
# require 'simpletest' | |
# | |
# class Foo < SimpleTest::TestCase | |
# | |
# def test_bar | |
# assert_equal 1, 1 |
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 Config | |
class Storage | |
def initialize(name, value = nil, parent = nil) | |
@_name = (parent ? "#{parent}." : '') + name | |
@_value = value | |
end | |
def method_missing(sym, *args) |
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
#! /usr/bin/env ruby | |
# -*- conding: utf-8 -*- | |
require 'nkf' | |
unless ARGV.size == 1 | |
warn 'pleese set directory' | |
exit | |
end | |