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
after :deploy, :tweet_presently | |
after "deploy:migrations", :tweet_presently | |
desc "Tweet into the present.ly group for this project" | |
task :tweet_presently, :roles => :app do | |
build_environment = (ENV['cap_server'].nil? ? "DEV" : ENV['cap_server']) | |
presently_user_name = ENV['PRESENTLY_USER'] | |
presently_user_name = "@#{presently_user_name.to_s.downcase}" unless presently_user_name.nil? | |
presently_user_name = ENV['USER'].capitalize if presently_user_name.blank? |
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 Lesson < ActiveRecord::Base | |
named_scope :find_with_xapian, lambda { |*args| {:conditions => ["lessons.id in (?)", ActsAsXapian::Search.new([Lesson], args.to_s).results.collect{|x| x[:model].id}]}} | |
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
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)] | |
} } do | |
def duration_by_project_per_weekday | |
from_date = DateTime.parse(self.proxy_options[:conditions][1]) | |
to_date = DateTime.parse(self.proxy_options[:conditions][2]) | |
weekday_count = weekday_count(from_date, to_date) |
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 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)] | |
} } do | |
def duration_by_project | |
self.sum(:duration, :group => :project) | |
end | |
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
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)] | |
} } do | |
def total_duration | |
self.sum(:duration) | |
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
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 |
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
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 |
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
test: | |
adapter: sqlite3 | |
database: db/test.sqlite3 | |
timeout: 5000 |
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
test: | |
adapter: mysql | |
encoding: utf8 | |
database: my_cool_application_test | |
username: integrity | |
password: mypassword123 |
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
$ 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'; |
NewerOlder