Skip to content

Instantly share code, notes, and snippets.

@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
# Short circuit a deliver_* methods defined in ActionMailer::Base subclasses.
def do_not_deliver!
def self.deliver! ; false ; end
end
development: &non-production
adapter: mysql
database: example_development
username: root
password:
host: localhost
timeout: 5000
test:
<<: *non-production
Rails::Initializer.run do |config|
%w(observers sweepers mailers).each do |dir|
config.load_paths << "#{RAILS_ROOT}/app/#{dir}"
end
end
-- 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
--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
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
has: function(selector) {
var $this = this;
return $this.find(selector).length > 0
},
$(document).ready(function($) {
var $div = $('<div style="height: 1px; min-height: 2px; position: absolute; top: -100px; left: -100px;"/>').appendTo('body');
$.support.minHeight = !!( $div[0].offsetHeight && $div[0].offsetHeight == 2 );
$div.remove();
});
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta http-equiv="content-type" content="text/html; charset=utf-8" >
<title>css3 buttons</title>
<style type="text/css">
body {
background: url(http://helloburin.com/images/stones.png);