Skip to content

Instantly share code, notes, and snippets.

% ruby1.8 -e '1.instance_eval{|i| p i}'
1
% ruby1.9 -e '1.instance_eval{|i| p i}'
nil
irb> [1,2].to_s
=> "12" # 1.8
=> "[1, 2]" # 1.9
irb> "Content-Type: #{MIME::Types.type_for('html')}"
=> "Content-Type: text/html" # 1.8
=> "Content-Type: [#<MIME::Type:0x9061248 @content_type=\"text/html\", @raw_ ... # 1.9
def compile
eval("def foo() end")
end
compile
p respond_to?(:foo)
true # 1.8
false # 1.9 (private method)
"_03_".to_i
# => 3 # ruby 1.8
# => 0 # ruby 1.9
--- a/merb-helpers/lib/merb-helpers/date_time_formatting.rb
+++ b/merb-helpers/lib/merb-helpers/date_time_formatting.rb
@@ -151,6 +151,6 @@ module OrdinalizedFormatting
# ==== Examples
# 5.days.ago.strftime_ordinalized('%b %d, %Y') # =>
def strftime_ordinalized(fmt, format=nil)
% irb -r lib/dm-ys -Ku
irb(main):001:0> cute = DataMapper::YS["http://www.utamap.com/fasearchkasi.php?page=0&sortname=3&artname=%A1%EE-ute&act=search*"]
=> #<Class:0xb78bf56c>
irb(main):002:0> cute.entries.map{|a| a[0]}
=> ["桜チラリ", "大きな愛でもてなして", "「忘れたくない夏」", "LA LA LA 幸せの歌", "めぐる恋の季節", "ほめられ伸び子のテーマ曲", "FOREVER LOVE", "美少女心理", "晴れのプラチナ通り", "涙の色", "ドドンガドン音頭", "都会っ子 純情", "ダーリンI LOVE YOU (℃-ute Ver.)", "セブンティーンズ VOW", "スイーーツ→→→ライブ", "JUMP", "私立共学", "最高級のエンジョイGIRLS", "越えろ!楽天イーグルス", "乙女COCORO", "江戸の手毬唄Ⅱ", "イメージカラー"]
irb(main):003:0> cute.first
=> #< id=1 ▲曲名▼="桜チラリ" 歌手="℃-ute" 作詞="つんく" 作曲="つんく" 歌いだし="桜チラリ" タイアップ情報="" CD="" DL="">
irb(main):004:0> cute.count
=> 22
** TERM signal received.
** Daemonized, any open files are closed. Look at log/mongrel.9615.pid and log/mongrel.9615.log for inf
o.
** Starting Mongrel listening at 0.0.0.0:9615
** Starting Rails with development environment...
** Mounting Rails at /so...
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:440:in `load_missing_
constant': uninitialized constant ActionController::AbstractRequest (NameError)
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `c
onst_missing'
Processing DeliveryUnitController#create (for 192.168.1.5 at 2009-03-20 17:21:46) [POST]
Parameters: {"itemname"=>{"contains"=>""}, "action"=>"create", "id"=>"300607680", "order"=>{"id"=>"300607680"}, "delivery_unit"=>{"end_at"=>"2009-03-21", "start_at"=>"2009-03-21", "pv"=>"1", "additional_path"=>"", "item_id"=>"100168"}, "controller"=>"delivery_unit", "search"=>"検索"}
...
Completed in 482ms (View: 1, DB: 30) | 200 OK [http://localhost/so/delivery_unit/create/300607680]/!\ FAILSAFE /!\ Fri Mar 20 17:21:47 +0900 2009
Status: 500 Internal Server Error can't dump
/usr/lib/ruby/1.8/drb/drb.rb:395:in `_dump'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/session_store.rb:67:in `dump'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/session_store.rb:67:in `marshal'
% ./configure
...
Pure is now configured for LLVM 2.2 on i686-pc-linux-gnu.
Source directory: .
Installation prefix: /usr/local
Compiler: g++ -g -O2
Linker: g++ -lgsl -lgslcblas -lm -lreadline
Build libpure: yes
Versioned install: yes
describe ConstraintSchema do
describe "の依存関係" do
table_fixture :constraint_schemas, <<-EOF
weborder_itmedia=# select * from constraint_schemas;
id | type | name | js | position | multiple | escape | enabled | version
----+-----------+------------+----------------------+----------+----------+--------+---------+---------
16 | Selection | 性別 | user_gender() == | 1 | f | t | t |
17 | Selection | 興味 | user_interests() in | 2 | t | t | t |
18 | Field | 回数制約 | user_freq() < | 3 | f | f | t |
describe ConstraintSchema do
table_fixture :constraint_schemas, <<-EOF, :name=>"name"
select * from constraint_schemas;
id | type | name | js | position | multiple | escape | enabled | version
----+-----------+------------+----------------------+----------+----------+--------+---------+---------
16 | Selection | 性別 | user_gender() == | 1 | f | t | t |
17 | Selection | 興味 | user_interests() in | 2 | t | t | t |
18 | Field | 回数制約 | user_freq() < | 3 | f | f | t |
19 | Checkbox | 新規ユーザ | user_newbie() | 4 | f | f | t |
20 | Custom | カスタム | | 5 | f | f | t |