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
# http://vermelho.jugem.jp/?eid=131 | |
gem install rdoc-data | |
cp -pR $rvm_path/gems/ruby-1.9.2-p290/gems/rdoc-data-2.5.3/data/1.9.1 $rvm_path/gems/ruby-1.9.2-p290/gems/rdoc-data-2.5.3/data/1.9.2 | |
rdoc-data --install | |
gem rdoc --all --overwrite | |
mkdir $rvm_path/gems/ruby-1.9.2-p290/gems/rails-3.0.9/lib | |
gem install rails |
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
package MyApp::View::Plugin::Ts; | |
=head1 MyApp::View::Plugin::Ts | |
imgタグのsrc属性値やlinkタグのhref属性値に対象のファイルの更新時刻を付加することで | |
ファイルの更新が行われた際にブラウザがキャッシュを捨てて再度リクエストすることを促すためのTTプラグイン | |
=cut | |
use strict; |
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
# | |
# Show differences between local and remote files. | |
# Compared files must be at same path. | |
# | |
# Usage: rd FILENAME REMOTE_HOST | |
# | |
rd() { | |
FILE=$1 | |
REMOTE=$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
x = nil # any object is OK. | |
loop { puts x = x.object_id } |
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 perl | |
my $name = $ARGV[0]; | |
chomp $name; | |
my $remote = $ARGV[1]; | |
chomp $remote; | |
my $path; | |
if ($name =~ /^//) { |
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
# [window1] start fsnotify.pl | |
$ cd ~/tmp | |
$ ... save fsnotify.pl here ... | |
$ perl fsnotify.pl [~ 22:39] | |
Watching tmp for file updates. | |
# [window2] rsync a file to the directory | |
$ rsync /somewhere/bar.txt ~/tmp |
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/ruby | |
class Object | |
# copied from http://blog.udzura.jp/2010/03/08/petit-hacking-about-const_get/ | |
def self.nested_const_get(name) | |
stack = (name.is_a?(Array)) ? name : name.to_s.split("::") | |
klass = Object | |
while const = stack.shift | |
klass = klass.const_get(const) | |
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 'rubygems' | |
require 'micro-optparse' | |
options = Parser.new { |p| | |
p.banner = "Generate .rvmrc file." | |
p.version = "0.1" | |
p.option :ruby, "Version of Ruby interpreter installed with RVM", :default => RUBY_VERSION | |
p.option :gemset, "Name of RVM gemset", :default => File.basename(`pwd`.strip) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>さんぷる</title> | |
<style type="text/css"> | |
.item { | |
display: -moz-box; | |
display: -webkit-box; | |
display: box; |
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 String | |
def camelize | |
split("_").map { |part| | |
part[0] = part[0].upcase | |
part | |
}.join | |
end | |
end |