- Setup a new Rails app
- Initialize a local repository using git
- Create a new remote repository using GitHub
- Change README.rdoc
- Deploy to a cloud service - Heroku
- Ruby is installed (v 1.9.3)
- Rails is installed (v 3.2.3)
class Product < ActiveRecord::Base | |
def self.find_by_criteria(params) | |
query = where("id IS NOT null") # A little odd but not sure how to get an ActiveRecord::Relation that returns "all" | |
query = query.where("price = ?", params[:price]) if params[:price].present? | |
query = query.where("manufacturer = ?", params[:manufacturer]) if params[:manufacturer].present? | |
query = query.where("retailer = ?", params[:retailer]) if params[:retailer].present? | |
query = query.where("category = ?", params[:category]) if params[:category].present? | |
query | |
end |
source :rubygems |
This is a response for one of our apprentices who wanted to learn more about how structs work.
Part of this is a response and part of it a challenge. If you are only interested in the challenge clone the repo and run rake (more detailed instructions here).
# Include alias file | |
if [ -f ~/.aliases ] | |
then | |
source ~/.aliases | |
fi |
namespace :deploy do | |
HEROKU_ACCOUNT = "account_name" | |
MAINLINE_BRANCH = "master" | |
STAGING_REPO = "app-name-staging" | |
PRODUCTION_REPO = "app-name-production" | |
def make_git_timestamp | |
"#{@env}-deploy-#{Time.now.to_s.gsub(/:/, "-").gsub(/\s/, "-").gsub(/--/, "-")}" | |
end |
require 'test/unit' | |
class ChangeMachine | |
# Returns an array indicating the quantity of | |
# each denomination required. | |
# [pennies, nickels, dimes, quarters] | |
def issue_coins(amount) | |
end | |
end |
# A sample Guardfile | |
# More info at https://github.com/guard/guard#readme | |
group :interactive do | |
guard 'spork', :rspec_env => {'RAILS_ENV' => 'test'}, :wait => 50 do | |
watch('config/application.rb') | |
watch('config/environment.rb') | |
watch(%r{^config/environments/.+\.rb$}) | |
watch(%r{^config/initializers/.+\.rb$}) |
Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.
Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.
Data Down / Actions Up
Plain JSBin's
Ember Version Base JSBin's