Skip to content

Instantly share code, notes, and snippets.

has: function(selector) {
var $this = this;
return $this.find(selector).length > 0
},
select p.screen_name, avg(a.best_answer)*100 as best_answer_percentage from answers a, profiles p where a.profile_id = p.id group by p.screen_name order by best_answer_percentage desc
--most referred questions in the past 7 days
select q.question, q.created_at as asked_on,count(1) as referrals from question_referrals r, questions q where r.question_id=q.id and r.created_at>SUBDATE(CURRENT_DATE(), INTERVAL 7 DAY) group by r.question_id order by referrals desc, asked_on desc
-- most active questions in the last 7 days
select q.question, q.created_at as asked_on, count(1) as answers from answers a, questions q where a.question_id=q.id and a.created_at>SUBDATE(CURRENT_DATE(), INTERVAL 7 DAY) group by a.question_id order by answers desc, asked_on desc
Rails::Initializer.run do |config|
%w(observers sweepers mailers).each do |dir|
config.load_paths << "#{RAILS_ROOT}/app/#{dir}"
end
end
development: &non-production
adapter: mysql
database: example_development
username: root
password:
host: localhost
timeout: 5000
test:
<<: *non-production
# Short circuit a deliver_* methods defined in ActionMailer::Base subclasses.
def do_not_deliver!
def self.deliver! ; false ; end
end
@burin
burin / gist:10752
Created September 14, 2008 19:07
My ~/.profile for ruby dev
# environment variables
export PATH=/usr/local/bin:$PATH
export PATH="$HOME/bin:$PATH"
export PATH=/usr/local/git/bin:$PATH
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export MANPATH=/usr/local/git/man:$MANPATH
export EDITOR="mate -w"
export SVN_EDITOR="mate -w"
# aliases