Skip to content

Instantly share code, notes, and snippets.

# config/initializers/compass.rb
require 'compass'
location_hash = {
"#{RAILS_ROOT}/app/stylesheets" => "#{RAILS_ROOT}/public/stylesheets"
}
Theme.find_all.map(&:name).each do |theme|
location_hash["#{RAILS_ROOT}/themes/#{theme}/stylesheets"] = "#{RAILS_ROOT}/themes/#{theme}/stylesheets"
end
$ cd /tmp
$ svn co http://svn.apache.org/repos/asf/couchdb/trunk couchdb
$ sudo port install automake autoconf libtool help2man icu spidermonkey erlang
$ cd couchdb
$ ./bootstrap
$ ./configure
$ make && sudo make install
$ sudo couchdb
$ gem sources -a http://gems.github.com
$ sudo gem install foca-integrity
$ integrity install /path/to/my/integrity/install
$ sudo apt-get install sqlite3 libsqlite3-dev
$ sudo gem install sqlite3-ruby
<VirtualHost *:80>
ServerName integrity.example.com
DocumentRoot /var/www/integrity/public
</VirtualHost>
$ mysql -uroot p
mysql> CREATE USER integrity INDENTIFIED BY PASSWORD 'mypassword123';
mysql> CREATE DATABASE my_cool_application_test;
mysql> GRANT ALL ON my_cool_application_test.* TO 'integrity'@localhost IDENTIFIED BY 'mypassword123';
test:
adapter: mysql
encoding: utf8
database: my_cool_application_test
username: integrity
password: mypassword123
test:
adapter: sqlite3
database: db/test.sqlite3
timeout: 5000
namespace :test do
task :move_test_db_config do
require 'ftools'
File.move(RAILS_ROOT+"/config/database.yml.test", RAILS_ROOT+"/config/database.yml")
end
end
class Entry < ActiveRecord::Base
named_scope :by_date, lambda { |*args|
{
:order => "starts_at asc",
:conditions => ["starts_at BETWEEN ? AND ?", args[0].beginning_of_day.to_s(:db), (args[1]||Time.now).end_of_day.to_s(:db)]
} }
end