This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionView::Helpers::AssetTagHelper.register_javascript_expansion( | |
:jquery => if Rails.env.production? | |
["http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"] | |
else | |
['jquery-1.4.2'] | |
end | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Since rubygems should have been required already, we can determine from the | |
# Gem object what is and isn't available. | |
if Gem.available?('thinking-sphinx') | |
require 'thinking_sphinx/0.9.8' | |
require 'thinking_sphinx/tasks' | |
require 'thinking_sphinx/deltas/datetime_delta/tasks' | |
else | |
puts 'gem thinking-sphinx required for all rake tasks' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Examples: | |
# Post.by_day | |
# Post.by_day(Time.yesterday) | |
# Post.by_day("next tuesday") | |
def by_day(time = Time.zone.now, options = {}, &block) | |
time = parse(time) | |
by_star(time.utc.beginning_of_day, time.utc.end_of_day, options, &block) | |
end | |
alias_method :today, :by_day | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Add the function below into your .bash_profile, .bash_login, or other shell profile file. | |
2) Then you can hit nt (for new tab) anywhere | |
and a new tab will open up in same directory. | |
All credit for the idea and applescript goes to @jnunemaker - I just tidied it up. | |
If you can improve it further, let him know -- [email protected]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def initialize | |
dispatch if respond_to?(:dispatch) | |
end | |
end | |
class B < A | |
def dispatch | |
puts "called dispatch" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- filtered_filenames(@items).each do |name| | |
%p do some stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Goal is => Client.first.items... Can do with finder_sql, but want an activerecord way! | |
class Client < ActiveRecord::Base | |
has_many :contacts | |
has_many :tasks, :through => :contacts | |
# has_many :items, :through => :tasks # THIS DOESNT WORK | |
def items | |
@items ||= self.tasks.collect { |task| task.items }.flatten | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RubyConf | |
RailsConf | |
RailsConf EU | |
acts_as_conference | |
Euruko | |
Ruby Kaigi | |
Mountain West RubyConf | |
eRubyCon | |
Ruby Hoedown | |
Amsterdam Ruby en Rails |