- What components are needed now?
- What components will be desired in the next 2 years?
- Editable content
- Blog
- Take Donations
- Photo Gallery
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 :backup do | |
desc "backup db from heroku and send to S3" | |
task :push_to_s3 => :environment do | |
Rake::Task[:environment].invoke | |
require 'aws/s3' | |
require 'heroku' | |
APP_NAME = 'luna-sandals' # put your app name here | |
BACKUP_BUCKET = "#{APP_NAME}-db-backups" # put your backup bucket name here | |
file_name = "backup-#{Time.now.strftime('%s')}.dump" |
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
/Users/Bookis/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2.rb:7:in `require': dlopen(/Users/Bookis/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) | |
Referenced from: /Users/Bookis/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle | |
Reason: image not found - /Users/Bookis/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle | |
from /Users/Bookis/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2.rb:7:in `<top (required)>' | |
from /Users/Bookis/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require' | |
from /Users/Bookis/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `block (2 levels) in require' | |
from /Users/Bookis/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each' | |
from /Users/Bookis/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `block in require' | |
from /Users/Bookis/.rvm |
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
# Put template stuff here |
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
run "echo TODO > README" | |
run "rvm use 1.9.2" | |
run "rvm gemset create #{app_name}" | |
create_file ".rvmrc", "rvm use 1.9.2@#{app_name}" | |
gem "rspec-rails" , :group => [ :development, :test ] | |
gem "guard-rspec" , :group => [ :development, :test ] | |
gem "spork", "> 0.9.0.rc" , :group => [ :development, :test ] | |
gem "guard-spork" , :group => [ :development, :test ] | |
gem "factory_girl_rails" , :group => [ :development, :test ] |
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 Comment | |
attr_accessor :content, :created_at | |
attr_reader :post_id, :author_id | |
def initialize(row) | |
@content = row[0] | |
@created_at = row[1] | |
@post_id = row[2] | |
@author_id = row[3] | |
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
#... | |
def current_visitor # This could be any name, `current_visitor` is just descriptive | |
if session[:visitor_id] # checking if the session hash has a key of :visitor_id | |
Visitor.find(session[:visitor_id]) # If there is a visitor id, find the Visitor by what is in the value of session[:visitor_id] | |
else | |
visitor = Visitor.create(ip_address: request.remote_ip) # If no session visitor id, create a new visitor assigning the ip_address | |
session[:visitor_id] = visitor.id # set the session hash visitor_id key to be the id of the record just created | |
visitor # return the visitor object that you just created, otherwiet the line above would be the last thing returned, but we want a Visitor object to be returned | |
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
# method that takes two inputs (an array, a target sum) | |
# outputs an array of pairs that sum to the target sum | |
# ([1,2,3,4], 5) => [[1,4], [2,3]] | |
def sum_pairs(array, target) | |
matches = [] | |
i = 0 | |
array.each do |first| | |
i += 1 | |
array[i..-1].each do |second| |
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 Transaction | |
attr_accessor :amount, :success | |
def initialize(amount, success) | |
@amount = amount | |
@success = success | |
end | |
def success? | |
@success |
OlderNewer