Skip to content

Instantly share code, notes, and snippets.

View spastorino's full-sized avatar

Santiago Pastorino spastorino

View GitHub Profile
@spastorino
spastorino / gist:278638
Created January 16, 2010 04:23
Missings do on rdoc
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 6ecd506..67eb3f2 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1746,10 +1746,10 @@ module ActiveRecord #:nodoc:
# class Article < ActiveRecord::Base
# def self.find_with_scope
# with_scope(:find => { :conditions => "blog_id = 1", :limit => 1 }, :create => { :blog_id => 1 }) do
- # with_scope(:find => { :limit => 10 })
+ # with_scope(:find => { :limit => 10 }) do
santiago@debian:~/Documentos/WyeWorks/Proys/rails/actionmailer$ rake test
(in /home/santiago/Documentos/WyeWorks/Proys/rails/actionmailer)
/home/santiago/Documentos/WyeWorks/Proys/rails/activesupport/lib/active_support/core_ext/time/conversions.rb:64: warning: method redefined; discarding old to_date
/home/santiago/Documentos/WyeWorks/Proys/rails/activesupport/lib/active_support/core_ext/time/conversions.rb:81: warning: method redefined; discarding old to_datetime
(eval):1: warning: method redefined; discarding old template
/home/santiago/Documentos/WyeWorks/Proys/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb:40: warning: discarding old concat
/home/santiago/Documentos/WyeWorks/Proys/rails/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb:168: warning: instance variable @_view_paths not initialized
/home/santiago/Documentos/WyeWorks/Proys/rails/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb:168: warning: instance variable @default_ur
Pending Cases:
test_response_cache_control_from_rackish_app at ./test/dispatch/response_test.rb, line 190
test_response_cache_control_from_railsish_app at ./test/dispatch/response_test.rb, line 171
test_response_charset_and_content_type_from_rackish_app at ./test/dispatch/response_test.rb, line 226
test_response_charset_and_content_type_from_railsish_app at ./test/dispatch/response_test.rb, line 208
test_file_stream at ./test/controller/send_file_test.rb, line 54
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
users = %w(wyeworks spastorino joseicosta smartinez87 nartub)
tweets = users.map { |user_name| Twitter::Search.new.from(user_name) }.
inject([]) { |tweets, search| tweets + search.fetch(5).results }.
sort { |t1, t2| Date.parse(t2.created_at) <=> Date.parse(t1.created_at) }[0..4]
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
index 3977971..567ba00 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -71,15 +71,12 @@ module ActiveSupport #:nodoc:
super(ERB::Util.h(value))
end
end
+ alias << concat
@spastorino
spastorino / date_helper.rb
Created February 25, 2010 03:38
*_select for date_helper
module ActionView
module Helpers
module DateHelper
[:second, :minute, :hour, :day, :month, :year].each do |name|
self.module_eval(<<-EOS)
def #{name.to_s}_select(object_name, method, options = {}, html_options = {})
InstanceTag.new(object_name, method, self, options.delete(:object)).to_#{name.to_s}_select_tag(options, html_options)
end
EOS
end
@spastorino
spastorino / ActionController options results used in different ways
Created April 16, 2010 19:56
ActionController options results used in different ways
class ApplicationController < ActionController::Base
end
class MyController < ApplicationController
end
ActionController::Base.perform_caching = true
ActionController::Base.perform_caching # => true
ActionController::Base.new.perform_caching # => true
santiago@debian:~/Documentos/WyeWorks/Proys/rails/activesupport/lib$ ruby ../../tools/profile test_shim.rb
test_shim.rb
tzinfo
tzinfo/timezone
date
85.10 KB 2249 obj 7.1 ms rational
222.82 KB 9538 obj 35.4 ms date/format
601.21 KB 23144 obj 86.1 ms date
tzinfo/country
tzinfo/country_info
@spastorino
spastorino / Rails tests on Rubinius
Created June 24, 2010 19:40
Rails tests on Rubinius
(in /home/santiago/Documentos/WyeWorks/Proys/rails)
(in /home/santiago/Documentos/WyeWorks/Proys/rails/activesupport)
Loaded suite /home/santiago/.rvm/gems/rbx-1.0.1-20100603/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.................................................................................................................................................................................................................................E.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
$ bundle install
Fetching source index for http://rubygems.org/
Fetching git://github.com/rails/rails.git
remote: Counting objects: 177081, done.
remote: Compressing objects: 100% (39674/39674), done.
remote: Total 177081 (delta 136781), reused 175748 (delta 135540)
Receiving objects: 100% (177081/177081), 30.62 MiB | 59 KiB/s, done.
Resolving deltas: 100% (136781/136781), done.
Fetching git://github.com/galetahub/rails-ckeditor.git
remote: Counting objects: 3622, done.