Ruby version: 1.8.7
1.クラス定義とメソッド定義
クラスの定義の仕方はJava及びPHPと大差はない。 しかしメソッド定義に関しては若干の違いがある。
class Hoge
#!/usr/local/bin/activeperl | |
use strict; | |
use warnings; | |
use AnyEvent; | |
use AnyEvent::Socket; | |
use AnyEvent::Handle; | |
use IO::Handle; | |
die "$0 <host> <port>" unless @ARGV; |
require 'rubygems' | |
require 'rubytter' | |
TARGET_USER = 'mitukiii' | |
LOG = ARGV.any? {|arg| arg == '-l' || arg == '-log'} | |
CURRENT_DIR = File.dirname(File.expand_path(__FILE__)) | |
OAUTH_YAML_NAME = 'mitukiii.jp.oauth.yaml' | |
FOLLOWERS_BEFORE_YAML_NAME = 'followers.txt' |
ja: | |
errors: | |
messages: | |
not_found: "は見つかりませんでした" | |
# not_found: "not found" | |
already_confirmed: "は既に登録済みです" | |
# already_confirmed: "was already confirmed" | |
not_locked: "は凍結されていません" | |
# not_locked: "was not locked" |
# Include plugins | |
require 'autotest/fsevent' | |
require 'autotest/growl' | |
# Skip some paths | |
Autotest.add_hook :initialize do |autotest| | |
%w{.git .DS_Store ._* vendor}.each { |exception| autotest.add_exception(exception) } | |
false | |
end |
<?xml version="1.0" encoding="UTF-8"?> | |
<opml version="1.0"> | |
<head> | |
<title>EngineersBlog</title> | |
</head> | |
<body> | |
<outline text="Baidu Japan Blog" title="Baidu Japan Blog" | |
type="rss" xmlUrl="http://staffblog.baidu.jp/feed/" htmlUrl="http://staffblog.baidu.jp"/> | |
<outline text="ECナビ エンジニアブログ" title="ECナビ エンジニアブログ" | |
type="rss" xmlUrl="http://tech.ecnavi.co.jp/index.rdf" htmlUrl="http://tech.ecnavi.co.jp/"/> |
attr_reader :foo |
user app; | |
worker_processes 2; | |
error_log /home/app/logs/nginx.error.log info; | |
events { | |
worker_connections 1024; | |
} | |
// Based on http://snipt.net/boriscy/datetime-jquery-formtastic/ | |
$.tools.dateinput.localize("ja", { | |
months: '1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月', | |
shortMonths: '1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月', | |
days: '日曜日,月曜日,火曜日,水曜日,木曜日,金曜日,土曜日', | |
shortDays: '日,月,火,水,木,金,土' | |
}); | |
$.tools.dateinput.conf.format = 'yyyy-mm-dd'; |
#!c:/bin/ruby/bin/ruby | |
# -*- encoding: shift_jis -*- | |
require 'rubygems' | |
require 'sqlite3' | |
# SQLite3 モジュールの取り込み。 | |
include SQLite3 |