Public Gists by dejan

Gravatar
Wed Sep 23 16:47:18 -0700 2009
1
2
3
You can represent time statements in most western languages where
a prefix and/or suffix is used.
 
Gravatar
Fri Jul 03 06:02:46 -0700 2009
1
<a class="hide" href="javascript:void(0);">hide</a>
gist: 123536 Nesting params in Rails
Gravatar
Thu Jun 04 02:27:54 -0700 2009
1
2
3
>> params = {"line_items"=>[{"quantity"=>"1"}, {"quantity"=>"2"}]}
=> {"line_items"=>[{"quantity"=>"1"}, {"quantity"=>"2"}]}
 
Gravatar
Mon Apr 20 10:51:19 -0700 2009
1
(0..6).map {|i| i.day.ago.strftime("%a")[0,1] }
gist: 93667 rake test:coverage
Gravatar
Sat Apr 11 11:31:41 -0700 2009
1
2
3
namespace :test do
  RCOV = "rcov --rails --aggregate coverage.data --text-summary -Ilib"
  
Gravatar
Thu Apr 09 12:48:56 -0700 2009
1
names.split(/\s*,\s*/).each { |name| ... }
gist: 89877 compact join
Gravatar
Fri Apr 03 11:22:41 -0700 2009
1
[options[:class], clazz].compact * ' '
gist: 89756 code filter for haml
Gravatar
Fri Apr 03 06:59:06 -0700 2009
1
2
3
module Haml
  module Filters
    module Code
Gravatar
Sat Mar 14 12:25:36 -0700 2009
1
"Poke %s!" % %w{him her}[@user.sex]
gist: 74643 (rails 2.3 feature) batch ...
Gravatar
Thu Mar 05 15:29:55 -0800 2009
1
2
3
Definition.find_in_batches { |group| group.each { |item| item.save } }
 
Video.find_in_batches { |group| group.each { |item| item.save } }
Gravatar
Sat Feb 28 13:50:00 -0800 2009
1
2
3
class String
 
  #
Gravatar
Sat Feb 28 13:49:25 -0800 2009
1
2
3
class Hash
 
  #
Gravatar
Wed Jan 07 03:21:52 -0800 2009
1
2
3
# have simple_captcha auto-solved while developing
# by putting this in config/environments/development.rb:
#