diff --git a/TimothyTsui/week_10/fruitstore/.gitignore b/TimothyTsui/week_10/fruitstore/.gitignore
new file mode 100644
index 0000000..050c9d9
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/.gitignore
@@ -0,0 +1,17 @@
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile '~/.gitignore_global'
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+/db/*.sqlite3-journal
+
+# Ignore all logfiles and tempfiles.
+/log/*
+!/log/.keep
+/tmp
diff --git a/TimothyTsui/week_10/fruitstore/.rspec b/TimothyTsui/week_10/fruitstore/.rspec
new file mode 100644
index 0000000..f8f74f2
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/.rspec
@@ -0,0 +1,3 @@
+--color
+--require spec_helper
+--format documentation
\ No newline at end of file
diff --git a/TimothyTsui/week_10/fruitstore/Gemfile b/TimothyTsui/week_10/fruitstore/Gemfile
new file mode 100644
index 0000000..8bf9073
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/Gemfile
@@ -0,0 +1,50 @@
+source 'https://rubygems.org'
+
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '4.2.5'
+# Use sqlite3 as the database for Active Record
+gem 'sqlite3'
+# Use SCSS for stylesheets
+gem 'sass-rails', '~> 5.0'
+# Use Uglifier as compressor for JavaScript assets
+gem 'uglifier', '>= 1.3.0'
+# Use CoffeeScript for .coffee assets and views
+gem 'coffee-rails', '~> 4.1.0'
+# See https://github.com/rails/execjs#readme for more supported runtimes
+# gem 'therubyracer', platforms: :ruby
+
+# Use jquery as the JavaScript library
+gem 'jquery-rails'
+# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
+gem 'turbolinks'
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem 'jbuilder', '~> 2.0'
+# bundle exec rake doc:rails generates the API under doc/api.
+gem 'sdoc', '~> 0.4.0', group: :doc
+
+# Use ActiveModel has_secure_password
+# gem 'bcrypt', '~> 3.1.7'
+
+# Use Unicorn as the app server
+# gem 'unicorn'
+
+# Use Capistrano for deployment
+# gem 'capistrano-rails', group: :development
+
+group :development, :test do
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
+ gem 'byebug'
+ gem 'rspec-rails'
+ gem 'shoulda-matchers', '2.6.2'
+ gem 'simplecov', :require => false # don't include in app, we'll add it manually
+end
+
+group :development do
+ # Access an IRB console on exception pages or by using <%= console %> in views
+ gem 'web-console', '~> 2.0'
+
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
+ gem 'spring'
+end
+
diff --git a/TimothyTsui/week_10/fruitstore/Gemfile.lock b/TimothyTsui/week_10/fruitstore/Gemfile.lock
new file mode 100644
index 0000000..fec79ed
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/Gemfile.lock
@@ -0,0 +1,188 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (4.2.5)
+ actionpack (= 4.2.5)
+ actionview (= 4.2.5)
+ activejob (= 4.2.5)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.5)
+ actionview (= 4.2.5)
+ activesupport (= 4.2.5)
+ rack (~> 1.6)
+ rack-test (~> 0.6.2)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (4.2.5)
+ activesupport (= 4.2.5)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (4.2.5)
+ activesupport (= 4.2.5)
+ globalid (>= 0.3.0)
+ activemodel (4.2.5)
+ activesupport (= 4.2.5)
+ builder (~> 3.1)
+ activerecord (4.2.5)
+ activemodel (= 4.2.5)
+ activesupport (= 4.2.5)
+ arel (~> 6.0)
+ activesupport (4.2.5)
+ i18n (~> 0.7)
+ json (~> 1.7, >= 1.7.7)
+ minitest (~> 5.1)
+ thread_safe (~> 0.3, >= 0.3.4)
+ tzinfo (~> 1.1)
+ arel (6.0.3)
+ binding_of_caller (0.7.2)
+ debug_inspector (>= 0.0.1)
+ builder (3.2.2)
+ byebug (8.2.1)
+ coffee-rails (4.1.1)
+ coffee-script (>= 2.2.0)
+ railties (>= 4.0.0, < 5.1.x)
+ coffee-script (2.4.1)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.10.0)
+ concurrent-ruby (1.0.0)
+ debug_inspector (0.0.2)
+ diff-lcs (1.2.5)
+ docile (1.1.5)
+ erubis (2.7.0)
+ execjs (2.6.0)
+ globalid (0.3.6)
+ activesupport (>= 4.1.0)
+ i18n (0.7.0)
+ jbuilder (2.4.0)
+ activesupport (>= 3.0.0, < 5.1)
+ multi_json (~> 1.2)
+ jquery-rails (4.1.0)
+ rails-dom-testing (~> 1.0)
+ railties (>= 4.2.0)
+ thor (>= 0.14, < 2.0)
+ json (1.8.3)
+ loofah (2.0.3)
+ nokogiri (>= 1.5.9)
+ mail (2.6.3)
+ mime-types (>= 1.16, < 3)
+ mime-types (2.99)
+ mini_portile2 (2.0.0)
+ minitest (5.8.4)
+ multi_json (1.11.2)
+ nokogiri (1.6.7.2)
+ mini_portile2 (~> 2.0.0.rc2)
+ rack (1.6.4)
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rails (4.2.5)
+ actionmailer (= 4.2.5)
+ actionpack (= 4.2.5)
+ actionview (= 4.2.5)
+ activejob (= 4.2.5)
+ activemodel (= 4.2.5)
+ activerecord (= 4.2.5)
+ activesupport (= 4.2.5)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 4.2.5)
+ sprockets-rails
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.7)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6.0)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-html-sanitizer (1.0.3)
+ loofah (~> 2.0)
+ railties (4.2.5)
+ actionpack (= 4.2.5)
+ activesupport (= 4.2.5)
+ rake (>= 0.8.7)
+ thor (>= 0.18.1, < 2.0)
+ rake (10.5.0)
+ rdoc (4.2.1)
+ json (~> 1.4)
+ rspec-core (3.4.2)
+ rspec-support (~> 3.4.0)
+ rspec-expectations (3.4.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.4.0)
+ rspec-mocks (3.4.1)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.4.0)
+ rspec-rails (3.4.1)
+ actionpack (>= 3.0, < 4.3)
+ activesupport (>= 3.0, < 4.3)
+ railties (>= 3.0, < 4.3)
+ rspec-core (~> 3.4.0)
+ rspec-expectations (~> 3.4.0)
+ rspec-mocks (~> 3.4.0)
+ rspec-support (~> 3.4.0)
+ rspec-support (3.4.1)
+ sass (3.4.21)
+ sass-rails (5.0.4)
+ railties (>= 4.0.0, < 5.0)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (>= 1.1, < 3)
+ sdoc (0.4.1)
+ json (~> 1.7, >= 1.7.7)
+ rdoc (~> 4.0)
+ shoulda-matchers (2.6.2)
+ activesupport (>= 3.0.0)
+ simplecov (0.11.1)
+ docile (~> 1.1.0)
+ json (~> 1.8)
+ simplecov-html (~> 0.10.0)
+ simplecov-html (0.10.0)
+ spring (1.6.2)
+ sprockets (3.5.2)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.0.0)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ sqlite3 (1.3.11)
+ thor (0.19.1)
+ thread_safe (0.3.5)
+ tilt (2.0.2)
+ turbolinks (2.5.3)
+ coffee-rails
+ tzinfo (1.2.2)
+ thread_safe (~> 0.1)
+ uglifier (2.7.2)
+ execjs (>= 0.3.0)
+ json (>= 1.8.0)
+ web-console (2.3.0)
+ activemodel (>= 4.0)
+ binding_of_caller (>= 0.7.2)
+ railties (>= 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ byebug
+ coffee-rails (~> 4.1.0)
+ jbuilder (~> 2.0)
+ jquery-rails
+ rails (= 4.2.5)
+ rspec-rails
+ sass-rails (~> 5.0)
+ sdoc (~> 0.4.0)
+ shoulda-matchers (= 2.6.2)
+ simplecov
+ spring
+ sqlite3
+ turbolinks
+ uglifier (>= 1.3.0)
+ web-console (~> 2.0)
+
+BUNDLED WITH
+ 1.10.6
diff --git a/TimothyTsui/week_10/fruitstore/README.rdoc b/TimothyTsui/week_10/fruitstore/README.rdoc
new file mode 100644
index 0000000..dd4e97e
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/README.rdoc
@@ -0,0 +1,28 @@
+== README
+
+This README would normally document whatever steps are necessary to get the
+application up and running.
+
+Things you may want to cover:
+
+* Ruby version
+
+* System dependencies
+
+* Configuration
+
+* Database creation
+
+* Database initialization
+
+* How to run the test suite
+
+* Services (job queues, cache servers, search engines, etc.)
+
+* Deployment instructions
+
+* ...
+
+
+Please feel free to use a different markup language if you do not plan to run
+rake doc:app.
diff --git a/TimothyTsui/week_10/fruitstore/Rakefile b/TimothyTsui/week_10/fruitstore/Rakefile
new file mode 100644
index 0000000..ba6b733
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/Rakefile
@@ -0,0 +1,6 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Rails.application.load_tasks
diff --git a/TimothyTsui/week_10/fruitstore/app/assets/images/.keep b/TimothyTsui/week_10/fruitstore/app/assets/images/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/app/assets/javascripts/application.js b/TimothyTsui/week_10/fruitstore/app/assets/javascripts/application.js
new file mode 100644
index 0000000..e07c5a8
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/assets/javascripts/application.js
@@ -0,0 +1,16 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// compiled file.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+//
+//= require jquery
+//= require jquery_ujs
+//= require turbolinks
+//= require_tree .
diff --git a/TimothyTsui/week_10/fruitstore/app/assets/javascripts/fruits.coffee b/TimothyTsui/week_10/fruitstore/app/assets/javascripts/fruits.coffee
new file mode 100644
index 0000000..24f83d1
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/assets/javascripts/fruits.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/TimothyTsui/week_10/fruitstore/app/assets/stylesheets/application.css b/TimothyTsui/week_10/fruitstore/app/assets/stylesheets/application.css
new file mode 100644
index 0000000..f9cd5b3
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
+ * compiled file so the styles you add here take precedence over styles defined in any styles
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
+ * file per style scope.
+ *
+ *= require_tree .
+ *= require_self
+ */
diff --git a/TimothyTsui/week_10/fruitstore/app/assets/stylesheets/fruits.scss b/TimothyTsui/week_10/fruitstore/app/assets/stylesheets/fruits.scss
new file mode 100644
index 0000000..c457d1b
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/assets/stylesheets/fruits.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Fruits controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/TimothyTsui/week_10/fruitstore/app/controllers/application_controller.rb b/TimothyTsui/week_10/fruitstore/app/controllers/application_controller.rb
new file mode 100644
index 0000000..d83690e
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/controllers/application_controller.rb
@@ -0,0 +1,5 @@
+class ApplicationController < ActionController::Base
+ # Prevent CSRF attacks by raising an exception.
+ # For APIs, you may want to use :null_session instead.
+ protect_from_forgery with: :exception
+end
diff --git a/TimothyTsui/week_10/fruitstore/app/controllers/concerns/.keep b/TimothyTsui/week_10/fruitstore/app/controllers/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/app/controllers/fruits_controller.rb b/TimothyTsui/week_10/fruitstore/app/controllers/fruits_controller.rb
new file mode 100644
index 0000000..03e545f
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/controllers/fruits_controller.rb
@@ -0,0 +1,22 @@
+class FruitsController < ApplicationController
+ def index
+ @fruits = Fruit.all.reverse
+
+ respond_to do |format|
+ format.html
+ format.json { render :json => @fruits }
+ end
+ end
+
+ def create
+ @fruit = Fruit.new :name => params[:fruit][:name]
+ if @fruit.save
+ redirect_to fruit_path(@fruit)
+ else
+ render :new
+ end
+ end
+
+ def show
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/app/helpers/application_helper.rb b/TimothyTsui/week_10/fruitstore/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/TimothyTsui/week_10/fruitstore/app/helpers/fruits_helper.rb b/TimothyTsui/week_10/fruitstore/app/helpers/fruits_helper.rb
new file mode 100644
index 0000000..3bdd698
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/helpers/fruits_helper.rb
@@ -0,0 +1,2 @@
+module FruitsHelper
+end
diff --git a/TimothyTsui/week_10/fruitstore/app/mailers/.keep b/TimothyTsui/week_10/fruitstore/app/mailers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/app/models/.keep b/TimothyTsui/week_10/fruitstore/app/models/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/app/models/apple.rb b/TimothyTsui/week_10/fruitstore/app/models/apple.rb
new file mode 100644
index 0000000..cd67a12
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/models/apple.rb
@@ -0,0 +1,17 @@
+# == Schema Information
+#
+# Table name: fruits
+#
+# id :integer not null, primary key
+# created_at :datetime not null
+# updated_at :datetime not null
+# name :string
+# type :string
+# shelf_id :integer
+#
+
+class Apple < Fruit
+ def squishy?
+ false
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/app/models/concerns/.keep b/TimothyTsui/week_10/fruitstore/app/models/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/app/models/fruit.rb b/TimothyTsui/week_10/fruitstore/app/models/fruit.rb
new file mode 100644
index 0000000..ceab4bd
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/models/fruit.rb
@@ -0,0 +1,21 @@
+# == Schema Information
+#
+# Table name: fruits
+#
+# id :integer not null, primary key
+# created_at :datetime not null
+# updated_at :datetime not null
+# name :string
+# type :string
+# shelf_id :integer
+#
+
+class Fruit < ActiveRecord::Base
+ belongs_to :shelf
+
+ validates :name, presence: true
+
+ def squishy?
+ nil
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/app/models/pear.rb b/TimothyTsui/week_10/fruitstore/app/models/pear.rb
new file mode 100644
index 0000000..91b1e8b
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/models/pear.rb
@@ -0,0 +1,17 @@
+# == Schema Information
+#
+# Table name: fruits
+#
+# id :integer not null, primary key
+# created_at :datetime not null
+# updated_at :datetime not null
+# name :string
+# type :string
+# shelf_id :integer
+#
+
+class Pear < Fruit
+ def squishy?
+ true
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/app/models/shelf.rb b/TimothyTsui/week_10/fruitstore/app/models/shelf.rb
new file mode 100644
index 0000000..3dc554f
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/models/shelf.rb
@@ -0,0 +1,12 @@
+# == Schema Information
+#
+# Table name: shelves
+#
+# id :integer not null, primary key
+# created_at :datetime not null
+# updated_at :datetime not null
+#
+
+class Shelf < ActiveRecord::Base
+ has_many :fruits
+end
diff --git a/TimothyTsui/week_10/fruitstore/app/views/fruits/create.html.erb b/TimothyTsui/week_10/fruitstore/app/views/fruits/create.html.erb
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/app/views/fruits/index.html.erb b/TimothyTsui/week_10/fruitstore/app/views/fruits/index.html.erb
new file mode 100644
index 0000000..47fb16a
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/views/fruits/index.html.erb
@@ -0,0 +1,5 @@
+
All Fruits
+
+<% @fruits.each do |fruit| %>
+ <%= fruit.name %>
+<% end %>
\ No newline at end of file
diff --git a/TimothyTsui/week_10/fruitstore/app/views/fruits/new.html.erb b/TimothyTsui/week_10/fruitstore/app/views/fruits/new.html.erb
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/app/views/layouts/application.html.erb b/TimothyTsui/week_10/fruitstore/app/views/layouts/application.html.erb
new file mode 100644
index 0000000..86d8c50
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/app/views/layouts/application.html.erb
@@ -0,0 +1,14 @@
+
+
+
+ Fruitstore
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
+ <%= csrf_meta_tags %>
+
+
+
+<%= yield %>
+
+
+
diff --git a/TimothyTsui/week_10/fruitstore/bin/bundle b/TimothyTsui/week_10/fruitstore/bin/bundle
new file mode 100755
index 0000000..66e9889
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/bin/bundle
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/TimothyTsui/week_10/fruitstore/bin/rails b/TimothyTsui/week_10/fruitstore/bin/rails
new file mode 100755
index 0000000..0138d79
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/bin/rails
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/TimothyTsui/week_10/fruitstore/bin/rake b/TimothyTsui/week_10/fruitstore/bin/rake
new file mode 100755
index 0000000..d87d5f5
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/bin/rake
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/TimothyTsui/week_10/fruitstore/bin/setup b/TimothyTsui/week_10/fruitstore/bin/setup
new file mode 100755
index 0000000..acdb2c1
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/bin/setup
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+Dir.chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file:
+
+ puts "== Installing dependencies =="
+ system "gem install bundler --conservative"
+ system "bundle check || bundle install"
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # system "cp config/database.yml.sample config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system "bin/rake db:setup"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system "rm -f log/*"
+ system "rm -rf tmp/cache"
+
+ puts "\n== Restarting application server =="
+ system "touch tmp/restart.txt"
+end
diff --git a/TimothyTsui/week_10/fruitstore/bin/spring b/TimothyTsui/week_10/fruitstore/bin/spring
new file mode 100755
index 0000000..62ec28f
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/bin/spring
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+
+# This file loads spring without using Bundler, in order to be fast.
+# It gets overwritten when you run the `spring binstub` command.
+
+unless defined?(Spring)
+ require 'rubygems'
+ require 'bundler'
+
+ if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
+ Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq }
+ gem 'spring', match[1]
+ require 'spring/binstub'
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/config.ru b/TimothyTsui/week_10/fruitstore/config.ru
new file mode 100644
index 0000000..bd83b25
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Rails.application
diff --git a/TimothyTsui/week_10/fruitstore/config/application.rb b/TimothyTsui/week_10/fruitstore/config/application.rb
new file mode 100644
index 0000000..232e446
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/application.rb
@@ -0,0 +1,35 @@
+require File.expand_path('../boot', __FILE__)
+
+require "rails"
+# Pick the frameworks you want:
+require "active_model/railtie"
+require "active_job/railtie"
+require "active_record/railtie"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_view/railtie"
+require "sprockets/railtie"
+# require "rails/test_unit/railtie"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module Fruitstore
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # Do not swallow errors in after_commit/after_rollback callbacks.
+ config.active_record.raise_in_transactional_callbacks = true
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/config/boot.rb b/TimothyTsui/week_10/fruitstore/config/boot.rb
new file mode 100644
index 0000000..6b750f0
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/boot.rb
@@ -0,0 +1,3 @@
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/TimothyTsui/week_10/fruitstore/config/database.yml b/TimothyTsui/week_10/fruitstore/config/database.yml
new file mode 100644
index 0000000..1c1a37c
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+#
+default: &default
+ adapter: sqlite3
+ pool: 5
+ timeout: 5000
+
+development:
+ <<: *default
+ database: db/development.sqlite3
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: db/test.sqlite3
+
+production:
+ <<: *default
+ database: db/production.sqlite3
diff --git a/TimothyTsui/week_10/fruitstore/config/environment.rb b/TimothyTsui/week_10/fruitstore/config/environment.rb
new file mode 100644
index 0000000..ee8d90d
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require File.expand_path('../application', __FILE__)
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/TimothyTsui/week_10/fruitstore/config/environments/development.rb b/TimothyTsui/week_10/fruitstore/config/environments/development.rb
new file mode 100644
index 0000000..b55e214
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/environments/development.rb
@@ -0,0 +1,41 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Debug mode disables concatenation and preprocessing of assets.
+ # This option may cause significant delays in view rendering with a large
+ # number of complex assets.
+ config.assets.debug = true
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # Adds additional error checking when serving assets at runtime.
+ # Checks for improperly declared sprockets dependencies.
+ # Raises helpful error messages.
+ config.assets.raise_runtime_errors = true
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/TimothyTsui/week_10/fruitstore/config/environments/production.rb b/TimothyTsui/week_10/fruitstore/config/environments/production.rb
new file mode 100644
index 0000000..5c1b32e
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/environments/production.rb
@@ -0,0 +1,79 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.cache_classes = true
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
+ # Add `rack-cache` to your Gemfile before enabling this.
+ # For large-scale production use, consider using a caching reverse proxy like
+ # NGINX, varnish or squid.
+ # config.action_dispatch.rack_cache = true
+
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
+
+ # Compress JavaScripts and CSS.
+ config.assets.js_compressor = :uglifier
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
+
+ # Prepend all log lines with the following tags.
+ # config.log_tags = [ :subdomain, :uuid ]
+
+ # Use a different logger for distributed setups.
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners.
+ config.active_support.deprecation = :notify
+
+ # Use default logging formatter so that PID and timestamp are not suppressed.
+ config.log_formatter = ::Logger::Formatter.new
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+end
diff --git a/TimothyTsui/week_10/fruitstore/config/environments/test.rb b/TimothyTsui/week_10/fruitstore/config/environments/test.rb
new file mode 100644
index 0000000..1c19f08
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/environments/test.rb
@@ -0,0 +1,42 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Do not eager load code on boot. This avoids loading your whole application
+ # just for the purpose of running a single test. If you are using a tool that
+ # preloads Rails for running tests, you may have to set it to true.
+ config.eager_load = false
+
+ # Configure static file server for tests with Cache-Control for performance.
+ config.serve_static_files = true
+ config.static_cache_control = 'public, max-age=3600'
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates.
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Randomize the order test cases are executed.
+ config.active_support.test_order = :random
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/TimothyTsui/week_10/fruitstore/config/initializers/assets.rb b/TimothyTsui/week_10/fruitstore/config/initializers/assets.rb
new file mode 100644
index 0000000..01ef3e6
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/initializers/assets.rb
@@ -0,0 +1,11 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/TimothyTsui/week_10/fruitstore/config/initializers/backtrace_silencers.rb b/TimothyTsui/week_10/fruitstore/config/initializers/backtrace_silencers.rb
new file mode 100644
index 0000000..59385cd
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
diff --git a/TimothyTsui/week_10/fruitstore/config/initializers/cookies_serializer.rb b/TimothyTsui/week_10/fruitstore/config/initializers/cookies_serializer.rb
new file mode 100644
index 0000000..7f70458
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/initializers/cookies_serializer.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.action_dispatch.cookies_serializer = :json
diff --git a/TimothyTsui/week_10/fruitstore/config/initializers/filter_parameter_logging.rb b/TimothyTsui/week_10/fruitstore/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 0000000..4a994e1
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/TimothyTsui/week_10/fruitstore/config/initializers/inflections.rb b/TimothyTsui/week_10/fruitstore/config/initializers/inflections.rb
new file mode 100644
index 0000000..ac033bf
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym 'RESTful'
+# end
diff --git a/TimothyTsui/week_10/fruitstore/config/initializers/mime_types.rb b/TimothyTsui/week_10/fruitstore/config/initializers/mime_types.rb
new file mode 100644
index 0000000..dc18996
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/initializers/mime_types.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
diff --git a/TimothyTsui/week_10/fruitstore/config/initializers/session_store.rb b/TimothyTsui/week_10/fruitstore/config/initializers/session_store.rb
new file mode 100644
index 0000000..a8dc990
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/initializers/session_store.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.session_store :cookie_store, key: '_fruitstore_session'
diff --git a/TimothyTsui/week_10/fruitstore/config/initializers/wrap_parameters.rb b/TimothyTsui/week_10/fruitstore/config/initializers/wrap_parameters.rb
new file mode 100644
index 0000000..33725e9
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/initializers/wrap_parameters.rb
@@ -0,0 +1,14 @@
+# Be sure to restart your server when you modify this file.
+
+# This file contains settings for ActionController::ParamsWrapper which
+# is enabled by default.
+
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
+ActiveSupport.on_load(:action_controller) do
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
+end
+
+# To enable root element in JSON for ActiveRecord objects.
+# ActiveSupport.on_load(:active_record) do
+# self.include_root_in_json = true
+# end
diff --git a/TimothyTsui/week_10/fruitstore/config/locales/en.yml b/TimothyTsui/week_10/fruitstore/config/locales/en.yml
new file mode 100644
index 0000000..0653957
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/locales/en.yml
@@ -0,0 +1,23 @@
+# Files in the config/locales directory are used for internationalization
+# and are automatically loaded by Rails. If you want to use locales other
+# than English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t 'hello'
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t('hello') %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more, please read the Rails Internationalization guide
+# available at http://guides.rubyonrails.org/i18n.html.
+
+en:
+ hello: "Hello world"
diff --git a/TimothyTsui/week_10/fruitstore/config/routes.rb b/TimothyTsui/week_10/fruitstore/config/routes.rb
new file mode 100644
index 0000000..e3ed026
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/routes.rb
@@ -0,0 +1,3 @@
+Rails.application.routes.draw do
+ resources :fruits, :only => [:index, :create, :show, :new]
+end
diff --git a/TimothyTsui/week_10/fruitstore/config/secrets.yml b/TimothyTsui/week_10/fruitstore/config/secrets.yml
new file mode 100644
index 0000000..8d75d4b
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/config/secrets.yml
@@ -0,0 +1,22 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rake secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+ secret_key_base: de291dd98a077c877da9a2f2007ebeaaa0fcd5babc3e9171dcd1e089d2e8822476e2f8bd3c7acdd726498ade2c6fe8b97525a8598fb98db696c9f43782d1a015
+
+test:
+ secret_key_base: 9f0285a18b74322e66e6ba238b2694b19ba31e4b2eb81c60328e8fe95fbfc308c4136e8452ab06fa38d1ba43419bb257453d818e2b2353397e0c4e78ec16dc1c
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/TimothyTsui/week_10/fruitstore/coverage/.last_run.json b/TimothyTsui/week_10/fruitstore/coverage/.last_run.json
new file mode 100644
index 0000000..3cb5e70
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/coverage/.last_run.json
@@ -0,0 +1,5 @@
+{
+ "result": {
+ "covered_percent": 100.0
+ }
+}
diff --git a/TimothyTsui/week_10/fruitstore/coverage/.resultset.json b/TimothyTsui/week_10/fruitstore/coverage/.resultset.json
new file mode 100644
index 0000000..c0bc8aa
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/coverage/.resultset.json
@@ -0,0 +1,531 @@
+{
+ "RSpec": {
+ "coverage": {
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/spec/controllers/fruits_controller_spec.rb": [
+ 1,
+ null,
+ 1,
+ 1,
+ 40,
+ null,
+ null,
+ 1,
+ 1,
+ 3,
+ null,
+ null,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 3,
+ null,
+ null,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 1,
+ 2,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 2,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/spec/rails_helper.rb": [
+ null,
+ 1,
+ 1,
+ null,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ 1,
+ null,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/environment.rb": [
+ null,
+ 1,
+ null,
+ null,
+ 1
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/application.rb": [
+ 1,
+ null,
+ 1,
+ null,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/boot.rb": [
+ 1,
+ null,
+ 1
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/environments/test.rb": [
+ 1,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/initializers/assets.rb": [
+ null,
+ null,
+ null,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/initializers/backtrace_silencers.rb": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/initializers/cookies_serializer.rb": [
+ null,
+ null,
+ 1
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/initializers/filter_parameter_logging.rb": [
+ null,
+ null,
+ null,
+ 1
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/initializers/inflections.rb": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/initializers/mime_types.rb": [
+ null,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/initializers/session_store.rb": [
+ null,
+ null,
+ 1
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/initializers/wrap_parameters.rb": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/config/routes.rb": [
+ 1,
+ 1,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/app/helpers/application_helper.rb": [
+ 1,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/app/helpers/fruits_helper.rb": [
+ 1,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/app/controllers/fruits_controller.rb": [
+ 1,
+ 1,
+ 6,
+ null,
+ 6,
+ 6,
+ 9,
+ null,
+ null,
+ null,
+ 1,
+ 4,
+ 4,
+ 2,
+ null,
+ 2,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/app/controllers/application_controller.rb": [
+ 1,
+ null,
+ null,
+ 1,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/spec/helpers/fruits_helper_spec.rb": [
+ 1,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/spec/models/fruit_spec.rb": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ 1,
+ 2,
+ null,
+ 1,
+ 1,
+ 2,
+ null,
+ null,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 2,
+ null,
+ null,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/app/models/fruit.rb": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ null,
+ 1,
+ null,
+ 1,
+ null,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/spec/models/shelf_spec.rb": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ null,
+ 1,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/app/models/shelf.rb": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/app/models/apple.rb": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 2,
+ null,
+ null
+ ],
+ "/Users/tim/Documents/WDI/hw/TimothyTsui/week_10/fruitstore/app/models/pear.rb": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 2,
+ null,
+ null
+ ]
+ },
+ "timestamp": 1453960994
+ }
+}
diff --git a/TimothyTsui/week_10/fruitstore/coverage/.resultset.json.lock b/TimothyTsui/week_10/fruitstore/coverage/.resultset.json.lock
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/coverage/assets/0.10.0/application.css b/TimothyTsui/week_10/fruitstore/coverage/assets/0.10.0/application.css
new file mode 100644
index 0000000..d865604
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/coverage/assets/0.10.0/application.css
@@ -0,0 +1,799 @@
+/* -----------------------------------------------------------------------
+
+
+ Blueprint CSS Framework 0.9
+ http://blueprintcss.org
+
+ * Copyright (c) 2007-Present. See LICENSE for more info.
+ * See README for instructions on how to use Blueprint.
+ * For credits and origins, see AUTHORS.
+ * This is a compressed file. See the sources in the 'src' directory.
+
+----------------------------------------------------------------------- */
+
+/* reset.css */
+
+html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
+article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;}
+body {line-height:1.5;}
+table {border-collapse:separate;border-spacing:0;}
+caption, th, td {text-align:left;font-weight:normal;}
+table, td, th {vertical-align:middle;}
+blockquote:before, blockquote:after, q:before, q:after {content:"";}
+blockquote, q {quotes:"" "";}
+a img {border:none;}
+
+/* typography.css */
+html {font-size:100.01%;}
+body {font-size:82%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
+h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
+h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
+h2 {font-size:2em;margin-bottom:0.75em;}
+h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
+h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
+h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
+h6 {font-size:1em;font-weight:bold;}
+h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
+p {margin:0 0 1.5em;}
+p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
+p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
+a:focus, a:hover {color:#000;}
+a {color:#009;text-decoration:underline;}
+blockquote {margin:1.5em;color:#666;font-style:italic;}
+strong {font-weight:bold;}
+em, dfn {font-style:italic;}
+dfn {font-weight:bold;}
+sup, sub {line-height:0;}
+abbr, acronym {border-bottom:1px dotted #666;}
+address {margin:0 0 1.5em;font-style:italic;}
+del {color:#666;}
+pre {margin:1.5em 0;white-space:pre;}
+pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
+li ul, li ol {margin:0;}
+ul, ol {margin:0 1.5em 1.5em 0;padding-left:3.333em;}
+ul {list-style-type:disc;}
+ol {list-style-type:decimal;}
+dl {margin:0 0 1.5em 0;}
+dl dt {font-weight:bold;}
+dd {margin-left:1.5em;}
+table {margin-bottom:1.4em;width:100%;}
+th {font-weight:bold;}
+thead th {background:#c3d9ff;}
+th, td, caption {padding:4px 10px 4px 5px;}
+tr.even td {background:#efefef;}
+tfoot {font-style:italic;}
+caption {background:#eee;}
+.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
+.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
+.hide {display:none;}
+.quiet {color:#666;}
+.loud {color:#000;}
+.highlight {background:#ff0;}
+.added {background:#060;color:#fff;}
+.removed {background:#900;color:#fff;}
+.first {margin-left:0;padding-left:0;}
+.last {margin-right:0;padding-right:0;}
+.top {margin-top:0;padding-top:0;}
+.bottom {margin-bottom:0;padding-bottom:0;}
+
+/* forms.css */
+label {font-weight:bold;}
+fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;}
+legend {font-weight:bold;font-size:1.2em;}
+input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;}
+input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;}
+input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;}
+input.text, input.title {width:300px;padding:5px;}
+input.title {font-size:1.5em;}
+textarea {width:390px;height:250px;padding:5px;}
+input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;}
+form.inline {line-height:3;}
+form.inline p {margin-bottom:0;}
+.error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
+.error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
+.notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
+.success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
+.error a {color:#8a1f11;}
+.notice a {color:#514721;}
+.success a {color:#264409;}
+.box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;}
+hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;}
+hr.space {background:#fff;color:#fff;visibility:hidden;}
+.clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
+.clearfix, .container {display:block;}
+.clear {clear:both;}
+/*
+github.com style (c) Vasily Polovnyov
+*/
+
+
+pre code {
+}
+
+pre .comment,
+pre .template_comment,
+pre .diff .header,
+pre .javadoc {
+ color: #998;
+ font-style: italic
+}
+
+pre .keyword,
+pre .css .rule .keyword,
+pre .winutils,
+pre .javascript .title,
+pre .lisp .title {
+ color: #000;
+ font-weight: bold
+}
+
+pre .number,
+pre .hexcolor {
+ color: #458
+}
+
+
+pre .string,
+pre .tag .value,
+pre .phpdoc,
+pre .tex .formula {
+ color: #d14
+}
+
+pre .subst {
+ color: #712;
+}
+
+pre .constant,
+pre .title,
+pre .id {
+ color: #900;
+ font-weight: bold
+}
+
+pre .javascript .title,
+pre .lisp .title,
+pre .subst {
+ font-weight: normal
+}
+
+pre .class .title,
+pre .haskell .label,
+pre .tex .command {
+ color: #458;
+ font-weight: bold
+}
+
+pre .tag,
+pre .tag .title,
+pre .rules .property,
+pre .django .tag .keyword {
+ color: #000080;
+ font-weight: normal
+}
+
+pre .attribute,
+pre .variable,
+pre .instancevar,
+pre .lisp .body {
+ color: #008080
+}
+
+pre .regexp {
+ color: #009926
+}
+
+pre .class {
+ color: #458;
+ font-weight: bold
+}
+
+pre .symbol,
+pre .ruby .symbol .string,
+pre .ruby .symbol .keyword,
+pre .ruby .symbol .keymethods,
+pre .lisp .keyword,
+pre .tex .special,
+pre .input_number {
+ color: #990073
+}
+
+pre .builtin,
+pre .built_in,
+pre .lisp .title {
+ color: #0086b3
+}
+
+pre .preprocessor,
+pre .pi,
+pre .doctype,
+pre .shebang,
+pre .cdata {
+ color: #999;
+ font-weight: bold
+}
+
+pre .deletion {
+ background: #fdd
+}
+
+pre .addition {
+ background: #dfd
+}
+
+pre .diff .change {
+ background: #0086b3
+}
+
+pre .chunk {
+ color: #aaa
+}
+
+pre .tex .formula {
+ opacity: 0.5;
+}
+/*
+ * jQuery UI CSS Framework @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
+.ui-widget-header a { color: #222222; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
+.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
+/*
+ ColorBox Core Style:
+ The following CSS is consistent between example themes and should not be altered.
+*/
+#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
+#cboxOverlay{position:fixed; width:100%; height:100%;}
+#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
+#cboxContent{position:relative;}
+#cboxLoadedContent{overflow:auto;}
+#cboxTitle{margin:0;}
+#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
+#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
+.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none;}
+.cboxIframe{width:100%; height:100%; display:block; border:0;}
+#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box;}
+
+/*
+ User Style:
+ Change the following styles to modify the appearance of ColorBox. They are
+ ordered & tabbed in a way that represents the nesting of the generated HTML.
+*/
+#cboxOverlay{background:#000;}
+#colorbox{}
+ #cboxTopLeft{width:14px; height:14px; background:url(colorbox/controls.png) no-repeat 0 0;}
+ #cboxTopCenter{height:14px; background:url(colorbox/border.png) repeat-x top left;}
+ #cboxTopRight{width:14px; height:14px; background:url(colorbox/controls.png) no-repeat -36px 0;}
+ #cboxBottomLeft{width:14px; height:43px; background:url(colorbox/controls.png) no-repeat 0 -32px;}
+ #cboxBottomCenter{height:43px; background:url(colorbox/border.png) repeat-x bottom left;}
+ #cboxBottomRight{width:14px; height:43px; background:url(colorbox/controls.png) no-repeat -36px -32px;}
+ #cboxMiddleLeft{width:14px; background:url(colorbox/controls.png) repeat-y -175px 0;}
+ #cboxMiddleRight{width:14px; background:url(colorbox/controls.png) repeat-y -211px 0;}
+ #cboxContent{background:#fff; overflow:visible;}
+ .cboxIframe{background:#fff;}
+ #cboxError{padding:50px; border:1px solid #ccc;}
+ #cboxLoadedContent{margin-bottom:5px;}
+ #cboxLoadingOverlay{background:url(colorbox/loading_background.png) no-repeat center center;}
+ #cboxLoadingGraphic{background:url(colorbox/loading.gif) no-repeat center center;}
+ #cboxTitle{position:absolute; bottom:-25px; left:0; text-align:center; width:100%; font-weight:bold; color:#7C7C7C;}
+ #cboxCurrent{position:absolute; bottom:-25px; left:58px; font-weight:bold; color:#7C7C7C;}
+
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{position:absolute; bottom:-29px; background:url(colorbox/controls.png) no-repeat 0px 0px; width:23px; height:23px; text-indent:-9999px;}
+ #cboxPrevious{left:0px; background-position: -51px -25px;}
+ #cboxPrevious:hover{background-position:-51px 0px;}
+ #cboxNext{left:27px; background-position:-75px -25px;}
+ #cboxNext:hover{background-position:-75px 0px;}
+ #cboxClose{right:0; background-position:-100px -25px;}
+ #cboxClose:hover{background-position:-100px 0px;}
+
+ .cboxSlideshow_on #cboxSlideshow{background-position:-125px 0px; right:27px;}
+ .cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0px;}
+ .cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px; right:27px;}
+ .cboxSlideshow_off #cboxSlideshow:hover{background-position:-125px 0px;}
+#loading {
+ position: fixed;
+ left: 40%;
+ top: 50%; }
+
+a {
+ color: #333333;
+ text-decoration: none; }
+ a:hover {
+ color: black;
+ text-decoration: underline; }
+
+body {
+ font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif;
+ padding: 12px;
+ background-color: #333333; }
+
+h1, h2, h3, h4 {
+ color: #1c2324;
+ margin: 0;
+ padding: 0;
+ margin-bottom: 12px; }
+
+table {
+ width: 100%; }
+
+#content {
+ clear: left;
+ background-color: white;
+ border: 2px solid #dddddd;
+ border-top: 8px solid #dddddd;
+ padding: 18px;
+ -webkit-border-bottom-left-radius: 5px;
+ -webkit-border-bottom-right-radius: 5px;
+ -webkit-border-top-right-radius: 5px;
+ -moz-border-radius-bottomleft: 5px;
+ -moz-border-radius-bottomright: 5px;
+ -moz-border-radius-topright: 5px;
+ border-bottom-left-radius: 5px;
+ border-bottom-right-radius: 5px;
+ border-top-right-radius: 5px; }
+
+.dataTables_filter, .dataTables_info {
+ padding: 2px 6px; }
+
+abbr.timeago {
+ text-decoration: none;
+ border: none;
+ font-weight: bold; }
+
+.timestamp {
+ float: right;
+ color: #dddddd; }
+
+.group_tabs {
+ list-style: none;
+ float: left;
+ margin: 0;
+ padding: 0; }
+ .group_tabs li {
+ display: inline;
+ float: left; }
+ .group_tabs li a {
+ font-family: Helvetica, Arial, sans-serif;
+ display: block;
+ float: left;
+ text-decoration: none;
+ padding: 4px 8px;
+ background-color: #aaaaaa;
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#dddddd), to(#aaaaaa));
+ background: -moz-linear-gradient(#dddddd, #aaaaaa);
+ background: linear-gradient(#dddddd, #aaaaaa);
+ text-shadow: #e5e5e5 1px 1px 0px;
+ border-bottom: none;
+ color: #333333;
+ font-weight: bold;
+ margin-right: 8px;
+ border-top: 1px solid #efefef;
+ -webkit-border-top-left-radius: 2px;
+ -webkit-border-top-right-radius: 2px;
+ -moz-border-radius-topleft: 2px;
+ -moz-border-radius-topright: 2px;
+ border-top-left-radius: 2px;
+ border-top-right-radius: 2px; }
+ .group_tabs li a:hover {
+ background-color: #cccccc;
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eeeeee), to(#aaaaaa));
+ background: -moz-linear-gradient(#eeeeee, #aaaaaa);
+ background: linear-gradient(#eeeeee, #aaaaaa); }
+ .group_tabs li a:active {
+ padding-top: 5px;
+ padding-bottom: 3px; }
+ .group_tabs li.active a {
+ color: black;
+ text-shadow: white 1px 1px 0px;
+ background-color: #dddddd;
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(white), to(#dddddd));
+ background: -moz-linear-gradient(white, #dddddd);
+ background: linear-gradient(white, #dddddd); }
+
+.file_list {
+ margin-bottom: 18px; }
+
+a.src_link {
+ background: url("./magnify.png") no-repeat left 50%;
+ padding-left: 18px; }
+
+tr, td {
+ margin: 0;
+ padding: 0; }
+
+th {
+ white-space: nowrap; }
+ th.ui-state-default {
+ cursor: pointer; }
+ th span.ui-icon {
+ float: left; }
+
+td {
+ padding: 4px 8px; }
+ td.strong {
+ font-weight: bold; }
+
+.source_table h3, .source_table h4 {
+ padding: 0;
+ margin: 0;
+ margin-bottom: 4px; }
+.source_table .header {
+ padding: 10px; }
+.source_table pre {
+ margin: 0;
+ padding: 0;
+ white-space: normal;
+ color: black;
+ font-family: "Monaco", "Inconsolata", "Consolas", monospace; }
+.source_table code {
+ color: black;
+ font-family: "Monaco", "Inconsolata", "Consolas", monospace; }
+.source_table pre {
+ background-color: #333333; }
+ .source_table pre ol {
+ margin: 0px;
+ padding: 0px;
+ margin-left: 45px;
+ font-size: 12px;
+ color: white; }
+ .source_table pre li {
+ margin: 0px;
+ padding: 2px 6px;
+ border-left: 5px solid white; }
+ .source_table pre li code {
+ white-space: pre;
+ white-space: pre-wrap; }
+ .source_table pre .hits {
+ float: right;
+ margin-left: 10px;
+ padding: 2px 4px;
+ background-color: #444444;
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#222222), to(#666666));
+ background: -moz-linear-gradient(#222222, #666666);
+ background: linear-gradient(#222222, #666666);
+ color: white;
+ font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
+ font-size: 10px;
+ font-weight: bold;
+ text-align: center;
+ border-radius: 6px; }
+
+#footer {
+ color: #dddddd;
+ font-size: 12px;
+ font-weight: bold;
+ margin-top: 12px;
+ text-align: right; }
+ #footer a {
+ color: #eeeeee;
+ text-decoration: underline; }
+ #footer a:hover {
+ color: white;
+ text-decoration: none; }
+
+.green {
+ color: #009900; }
+
+.red {
+ color: #990000; }
+
+.yellow {
+ color: #ddaa00; }
+
+.source_table .covered {
+ border-color: #009900; }
+.source_table .missed {
+ border-color: #990000; }
+.source_table .never {
+ border-color: black; }
+.source_table .skipped {
+ border-color: #ffcc00; }
+.source_table .covered:nth-child(odd) {
+ background-color: #cdf2cd; }
+.source_table .covered:nth-child(even) {
+ background-color: #dbf2db; }
+.source_table .missed:nth-child(odd) {
+ background-color: #f7c0c0; }
+.source_table .missed:nth-child(even) {
+ background-color: #f7cfcf; }
+.source_table .never:nth-child(odd) {
+ background-color: #efefef; }
+.source_table .never:nth-child(even) {
+ background-color: #f4f4f4; }
+.source_table .skipped:nth-child(odd) {
+ background-color: #fbf0c0; }
+.source_table .skipped:nth-child(even) {
+ background-color: #fbffcf; }
+
+
+
diff --git a/TimothyTsui/week_10/fruitstore/coverage/assets/0.10.0/application.js b/TimothyTsui/week_10/fruitstore/coverage/assets/0.10.0/application.js
new file mode 100644
index 0000000..fe65d88
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/coverage/assets/0.10.0/application.js
@@ -0,0 +1,1707 @@
+/*!
+ * jQuery JavaScript Library v1.6.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Jun 30 14:16:56 2011 -0400
+ */
+
+(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"":"")+""),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
+
+
diff --git a/TimothyTsui/week_10/fruitstore/db/migrate/20160127231615_create_fruits.rb b/TimothyTsui/week_10/fruitstore/db/migrate/20160127231615_create_fruits.rb
new file mode 100644
index 0000000..a334900
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/db/migrate/20160127231615_create_fruits.rb
@@ -0,0 +1,8 @@
+class CreateFruits < ActiveRecord::Migration
+ def change
+ create_table :fruits do |t|
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/db/migrate/20160127232941_add_name_to_fruits.rb b/TimothyTsui/week_10/fruitstore/db/migrate/20160127232941_add_name_to_fruits.rb
new file mode 100644
index 0000000..8afc3f4
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/db/migrate/20160127232941_add_name_to_fruits.rb
@@ -0,0 +1,5 @@
+class AddNameToFruits < ActiveRecord::Migration
+ def change
+ add_column :fruits, :name, :string
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/db/migrate/20160127233932_add_type_to_fruits.rb b/TimothyTsui/week_10/fruitstore/db/migrate/20160127233932_add_type_to_fruits.rb
new file mode 100644
index 0000000..c8a4aad
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/db/migrate/20160127233932_add_type_to_fruits.rb
@@ -0,0 +1,5 @@
+class AddTypeToFruits < ActiveRecord::Migration
+ def change
+ add_column :fruits, :type, :string
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/db/migrate/20160128001717_create_shelves.rb b/TimothyTsui/week_10/fruitstore/db/migrate/20160128001717_create_shelves.rb
new file mode 100644
index 0000000..545f3fd
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/db/migrate/20160128001717_create_shelves.rb
@@ -0,0 +1,8 @@
+class CreateShelves < ActiveRecord::Migration
+ def change
+ create_table :shelves do |t|
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/db/migrate/20160128003436_add_shelf_id_to_fruits.rb b/TimothyTsui/week_10/fruitstore/db/migrate/20160128003436_add_shelf_id_to_fruits.rb
new file mode 100644
index 0000000..fae5168
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/db/migrate/20160128003436_add_shelf_id_to_fruits.rb
@@ -0,0 +1,5 @@
+class AddShelfIdToFruits < ActiveRecord::Migration
+ def change
+ add_column :fruits, :shelf_id, :integer
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/db/schema.rb b/TimothyTsui/week_10/fruitstore/db/schema.rb
new file mode 100644
index 0000000..be2ec17
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/db/schema.rb
@@ -0,0 +1,29 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema.define(version: 20160128003436) do
+
+ create_table "fruits", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.string "name"
+ t.string "type"
+ t.integer "shelf_id"
+ end
+
+ create_table "shelves", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+end
diff --git a/TimothyTsui/week_10/fruitstore/db/seeds.rb b/TimothyTsui/week_10/fruitstore/db/seeds.rb
new file mode 100644
index 0000000..4edb1e8
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
+# Mayor.create(name: 'Emanuel', city: cities.first)
diff --git a/TimothyTsui/week_10/fruitstore/lib/assets/.keep b/TimothyTsui/week_10/fruitstore/lib/assets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/lib/tasks/.keep b/TimothyTsui/week_10/fruitstore/lib/tasks/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/log/.keep b/TimothyTsui/week_10/fruitstore/log/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/public/404.html b/TimothyTsui/week_10/fruitstore/public/404.html
new file mode 100644
index 0000000..b612547
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/TimothyTsui/week_10/fruitstore/public/422.html b/TimothyTsui/week_10/fruitstore/public/422.html
new file mode 100644
index 0000000..a21f82b
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/TimothyTsui/week_10/fruitstore/public/500.html b/TimothyTsui/week_10/fruitstore/public/500.html
new file mode 100644
index 0000000..061abc5
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/TimothyTsui/week_10/fruitstore/public/favicon.ico b/TimothyTsui/week_10/fruitstore/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/public/robots.txt b/TimothyTsui/week_10/fruitstore/public/robots.txt
new file mode 100644
index 0000000..3c9c7c0
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/public/robots.txt
@@ -0,0 +1,5 @@
+# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
+#
+# To ban all spiders from the entire site uncomment the next two lines:
+# User-agent: *
+# Disallow: /
diff --git a/TimothyTsui/week_10/fruitstore/spec/controllers/fruits_controller_spec.rb b/TimothyTsui/week_10/fruitstore/spec/controllers/fruits_controller_spec.rb
new file mode 100644
index 0000000..06dff57
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/spec/controllers/fruits_controller_spec.rb
@@ -0,0 +1,81 @@
+require 'rails_helper'
+
+RSpec.describe FruitsController, type: :controller do
+ before do
+ 3.times { |i| Fruit.create :name => "Fruit number #{ i }" }
+ end
+
+ describe 'as HTML' do
+ before do
+ get :index
+ end
+
+ it 'should respond with a status 200' do
+ expect(response).to be_success
+ expect(response.status).to eq(200)
+ end
+
+ it 'should give fruits in an instance variable in reverse order' do
+ expect(assigns(:fruits)).to be # check that @fruits exists in the controller. can't access @fruits in controller so we use 'assigns'
+ expect(assigns(:fruits).length).to eq 3
+ expect(assigns(:fruits).first.class).to eq Fruit
+ expect(assigns(:fruits).first.name).to eq 'Fruit number 2'
+ end
+
+ it 'should render the index template' do
+ expect(response).to render_template('index')
+ end
+ end
+
+ describe 'as JSON' do
+ before do
+ get :index, :format => :json
+ end
+
+ it 'should respond with a status 200' do
+ expect(response).to be_success
+ expect(response.status).to eq(200)
+ end
+
+ it 'should have content type JSON' do
+ expect(response.content_type).to eq('application/json')
+ end
+
+ it 'should put the name of the fruit in the JSON' do
+ fruits = JSON.parse(response.body)
+ expect(fruits.length).to eq(3)
+ expect(fruits.first['name']).to eq('Fruit number 2')
+ end
+ end
+
+ describe 'POST to create' do
+ describe 'a fruit with valid information' do
+ before do
+ post :create, { :fruit => { :name => 'Strawberry' } }
+ end
+
+ it 'should redirect to the show action' do
+ expect(response).to redirect_to(fruit_path(assigns(:fruit)))
+ end
+
+ it 'should increase the number of fruits' do
+ expect(Fruit.count).to eq(4) # or maybe one, try and see
+ end
+
+ end
+
+ describe 'a fruit without a name' do
+ before do
+ post :create, { :fruit => { :name => '' } }
+ end
+
+ it 'should render the new template' do
+ expect(response).to render_template('new')
+ end
+
+ it 'should not increase the number of fruits' do
+ expect(Fruit.count).to eq(3) # or maybe zero
+ end
+ end
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/spec/helpers/fruits_helper_spec.rb b/TimothyTsui/week_10/fruitstore/spec/helpers/fruits_helper_spec.rb
new file mode 100644
index 0000000..557f679
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/spec/helpers/fruits_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the FruitsHelper. For example:
+#
+# describe FruitsHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe FruitsHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/TimothyTsui/week_10/fruitstore/spec/models/fruit_spec.rb b/TimothyTsui/week_10/fruitstore/spec/models/fruit_spec.rb
new file mode 100644
index 0000000..638b442
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/spec/models/fruit_spec.rb
@@ -0,0 +1,57 @@
+# == Schema Information
+#
+# Table name: fruits
+#
+# id :integer not null, primary key
+# created_at :datetime not null
+# updated_at :datetime not null
+# name :string
+# type :string
+# shelf_id :integer
+#
+
+require 'rails_helper'
+
+RSpec.describe Fruit, type: :model do
+ it { should belong_to :shelf }
+
+ describe 'An apple' do
+ before do
+ @apple = Apple.create :name => 'Granny Smith'
+ end
+
+ it "should not be squishy" do
+ expect(@apple.squishy?).to eq false
+ expect(@apple.squishy?).to be false
+ end
+
+ it "should remember what class it is using Single Table Inheritance (STI)" do
+ apple = Fruit.find @apple.id
+ expect(apple).to_not be nil
+ expect(apple.class).to eq Apple
+ expect(apple).to eq @apple
+ expect(apple.is_a?(Fruit)).to be true
+ expect(apple.class.ancestors).to include Fruit
+ end
+ end
+
+ describe 'A pear' do
+ before do
+ @pear = Pear.create :name => 'Nashi pear'
+ end
+
+ it "should be squishy" do
+ expect(@pear.squishy?).to eq true
+ expect(@pear.squishy?).to be true
+ end
+
+ it "should remember what class it is using Single Table Inheritance" do
+ pear = Fruit.find @pear.id
+ expect(pear).to_not be nil
+ expect(pear.class).to eq Pear
+ expect(pear).to eq @pear
+ expect(pear.is_a?(Fruit)).to be true
+ expect(pear.class.ancestors).to include Fruit
+ end
+ end
+end
diff --git a/TimothyTsui/week_10/fruitstore/spec/models/shelf_spec.rb b/TimothyTsui/week_10/fruitstore/spec/models/shelf_spec.rb
new file mode 100644
index 0000000..c623586
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/spec/models/shelf_spec.rb
@@ -0,0 +1,14 @@
+# == Schema Information
+#
+# Table name: shelves
+#
+# id :integer not null, primary key
+# created_at :datetime not null
+# updated_at :datetime not null
+#
+
+require 'rails_helper'
+
+RSpec.describe Shelf, type: :model do
+ # it { should have_many :fruits }
+end
diff --git a/TimothyTsui/week_10/fruitstore/spec/rails_helper.rb b/TimothyTsui/week_10/fruitstore/spec/rails_helper.rb
new file mode 100644
index 0000000..6f1ab14
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/spec/rails_helper.rb
@@ -0,0 +1,57 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
+# Prevent database truncation if the environment is production
+abort("The Rails environment is running in production mode!") if Rails.env.production?
+require 'spec_helper'
+require 'rspec/rails'
+# Add additional requires below this line. Rails is not loaded until this point!
+
+# Requires supporting ruby files with custom matchers and macros, etc, in
+# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
+# run as spec files by default. This means that files in spec/support that end
+# in _spec.rb will both be required and run as specs, causing the specs to be
+# run twice. It is recommended that you do not name files matching this glob to
+# end with _spec.rb. You can configure this pattern with the --pattern
+# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
+#
+# The following line is provided for convenience purposes. It has the downside
+# of increasing the boot-up time by auto-requiring all files in the support
+# directory. Alternatively, in the individual `*_spec.rb` files, manually
+# require only the support files necessary.
+#
+# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
+
+# Checks for pending migration and applies them before tests are run.
+# If you are not using ActiveRecord, you can remove this line.
+ActiveRecord::Migration.maintain_test_schema!
+
+RSpec.configure do |config|
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # RSpec Rails can automatically mix in different behaviours to your tests
+ # based on their file location, for example enabling you to call `get` and
+ # `post` in specs under `spec/controllers`.
+ #
+ # You can disable this behaviour by removing the line below, and instead
+ # explicitly tag your specs with their type, e.g.:
+ #
+ # RSpec.describe UsersController, :type => :controller do
+ # # ...
+ # end
+ #
+ # The different available types are documented in the features, such as in
+ # https://relishapp.com/rspec/rspec-rails/docs
+ config.infer_spec_type_from_file_location!
+
+ # Filter lines from Rails gems in backtraces.
+ config.filter_rails_from_backtrace!
+ # arbitrary gems may also be filtered via:
+ # config.filter_gems_from_backtrace("gem name")
+end
diff --git a/TimothyTsui/week_10/fruitstore/spec/spec_helper.rb b/TimothyTsui/week_10/fruitstore/spec/spec_helper.rb
new file mode 100644
index 0000000..1a4c701
--- /dev/null
+++ b/TimothyTsui/week_10/fruitstore/spec/spec_helper.rb
@@ -0,0 +1,95 @@
+# This file was generated by the `rails generate rspec:install` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# The `.rspec` file also contains a few flags that are not defaults but that
+# users commonly want.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+require 'simplecov'
+SimpleCov.start
+
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # These two settings work together to allow you to limit a spec run
+ # to individual examples or groups you care about by tagging them with
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
+ # get run.
+ config.filter_run :focus
+ config.run_all_when_everything_filtered = true
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ config.disable_monkey_patching!
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = 'doc'
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end
diff --git a/TimothyTsui/week_10/fruitstore/vendor/assets/javascripts/.keep b/TimothyTsui/week_10/fruitstore/vendor/assets/javascripts/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_10/fruitstore/vendor/assets/stylesheets/.keep b/TimothyTsui/week_10/fruitstore/vendor/assets/stylesheets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/TimothyTsui/week_11/binary_search/binary_search.rb b/TimothyTsui/week_11/binary_search/binary_search.rb
new file mode 100644
index 0000000..476c97b
--- /dev/null
+++ b/TimothyTsui/week_11/binary_search/binary_search.rb
@@ -0,0 +1,21 @@
+require 'pry'
+
+# hi - index of last element
+# lo - index of first element
+def binarySearch array, targetNum, hi = nil, lo = nil
+ hi = array.length - 1 if hi.nil?
+ lo = 0 if lo.nil?
+ # puts "arr #{array} hi #{hi} lo #{lo}"
+ mid = ( hi + lo ) / 2 # index of middle element
+ if array[mid] == targetNum
+ mid
+ elsif lo >= hi # > is when [1,3,5,7] and targetNum = 4
+ -1 # targetNum not in array
+ elsif array[mid] > targetNum
+ hi = mid - 1
+ binarySearch array, targetNum, hi, lo
+ elsif array[mid] < targetNum
+ lo = mid + 1
+ binarySearch array, targetNum, hi, lo
+ end
+end
\ No newline at end of file
diff --git a/TimothyTsui/week_11/binary_search/binary_search_test.rb b/TimothyTsui/week_11/binary_search/binary_search_test.rb
new file mode 100644
index 0000000..b238b12
--- /dev/null
+++ b/TimothyTsui/week_11/binary_search/binary_search_test.rb
@@ -0,0 +1,94 @@
+require_relative 'binary_search'
+require 'minitest/autorun'
+require 'minitest/pride'
+
+class TestBinarySearch < Minitest::Test
+ def test_search_mid
+ # skip
+ assert_equal 1, binarySearch((1..3).to_a, 2)
+ end
+
+ def test_search_low
+ # skip
+ assert_equal 0, binarySearch((1..3).to_a, 1)
+ end
+
+ def test_search_hi
+ # skip
+ assert_equal 2, binarySearch((1..3).to_a, 3)
+ end
+
+ def test_search_5_elements
+ # skip
+ assert_equal 2, binarySearch((1..5).to_a, 3)
+ end
+
+ def test_search_5_elements2
+ # skip
+ assert_equal 0, binarySearch((1..5).to_a, 1)
+ end
+
+ def test_search_5_elements3
+ # skip
+ assert_equal 1, binarySearch((1..5).to_a, 2)
+ end
+
+ def test_search_5_elements4
+ # skip
+ assert_equal 3, binarySearch((1..5).to_a, 4)
+ end
+
+ def test_search_5_elements5
+ # skip
+ assert_equal 4, binarySearch((1..5).to_a, 5)
+ end
+
+ def test_search_4_elements
+ # skip
+ assert_equal 2, binarySearch((1..4).to_a, 3)
+ end
+
+ def test_search_4_elements2
+ # skip
+ assert_equal 0, binarySearch((1..4).to_a, 1)
+ end
+
+ def test_search_4_elements3
+ # skip
+ assert_equal 1, binarySearch((1..4).to_a, 2)
+ end
+
+ def test_search_4_elements4
+ # skip
+ assert_equal 3, binarySearch((1..4).to_a, 4)
+ end
+
+ def test_search_2_elements
+ # skip
+ assert_equal 0, binarySearch((1..2).to_a, 1)
+ end
+
+ def test_search_2_elements2
+ # skip
+ assert_equal 1, binarySearch((1..2).to_a, 2)
+ end
+
+ def test_search_nonexistent_num
+ # skip
+ assert_equal -1, binarySearch((1..3).to_a, 4)
+ end
+
+ def test_search_nonexistent_num2
+ # skip
+ assert_equal -1, binarySearch((1..3).to_a, 0)
+ end
+
+ def test_search_not_contiguous
+ # skip
+ assert_equal -1, binarySearch([1,3,5,7], 4)
+ end
+
+ def test_example
+ assert_equal 3, binarySearch([4, 5, 7, 12, 45], 12)
+ end
+end
diff --git a/TimothyTsui/week_11/singly_linked_list/.rspec b/TimothyTsui/week_11/singly_linked_list/.rspec
new file mode 100644
index 0000000..83e16f8
--- /dev/null
+++ b/TimothyTsui/week_11/singly_linked_list/.rspec
@@ -0,0 +1,2 @@
+--color
+--require spec_helper
diff --git a/TimothyTsui/week_11/singly_linked_list/sll.rb b/TimothyTsui/week_11/singly_linked_list/sll.rb
new file mode 100644
index 0000000..771fdb4
--- /dev/null
+++ b/TimothyTsui/week_11/singly_linked_list/sll.rb
@@ -0,0 +1,124 @@
+# bros = SinglyLinkedList.new
+# bros.append('Groucho')
+# bros.append('Harpo')
+
+class SinglyLinkedList
+ attr_reader :head
+
+ def initialize(start_value=nil)
+ @head = Node.new(start_value) unless start_value.nil?
+ end
+
+ def first
+ @head
+ end
+
+ def last
+ last_node = @head
+ while last_node && last_node.next
+ last_node = last_node.next
+ end
+ last_node
+ end
+
+ def append(value)
+ node = Node.new value
+ last_node = self.last
+ if last_node.nil?
+ @head = node
+ else
+ last_node.next = node
+ end
+ end
+
+ def prepend(value)
+ newHead = Node.new value
+ first_node = self.first
+ if first_node.nil?
+ @head = newHead
+ else
+ newHead.next = @head
+ @head = newHead
+ end
+ end
+
+ def length # Also #count and #size (Ruby has a nice way to alias things)
+ cur_node = self.head
+ len = 0
+ while cur_node
+ len += 1
+ cur_node = cur_node.next
+ end
+ len
+ end
+ alias_method :size, :length
+ alias_method :count, :length
+
+ # returns the node containing the needle as its value
+ def find(needle)
+ cur_node = @head
+ while cur_node
+ return cur_node if cur_node.value == needle
+ cur_node = cur_node.next
+ end
+ nil
+ end
+
+ # returns a new SLL with the nodes in reverse order
+ def reverse
+ reversed = SinglyLinkedList.new
+ node = @head
+ while node
+ reversed.prepend node.value
+ node = node.next
+ end
+ reversed
+ end
+
+ # in-place reverse. O(n) running time
+ def reverse!
+ return self if self.length == 1
+ prev = nil
+ while cur = @head
+ @head = cur.next
+ cur.next = prev
+ prev = cur
+ end
+ @head = prev
+ self
+ end
+
+ def each
+ # your tricky code here. Takes a block that does something. Hint: yield
+ node = @head
+ while node
+ yield node
+ node = node.next
+ end
+ end
+
+ def map
+ # this is trivial once #each is working
+ map = SinglyLinkedList.new
+ node = @head
+ while node
+ res = yield node
+ map.append res
+ node = node.next
+ end
+ map
+ end
+
+ class Node
+ attr_accessor :value, :next
+ def initialize(value=nil)
+ @value = value
+ @next = nil
+ end
+ end
+
+end
+
+
+# require 'pry'
+# binding.pry
\ No newline at end of file
diff --git a/TimothyTsui/week_11/singly_linked_list/spec/sll_spec.rb b/TimothyTsui/week_11/singly_linked_list/spec/sll_spec.rb
new file mode 100644
index 0000000..76880eb
--- /dev/null
+++ b/TimothyTsui/week_11/singly_linked_list/spec/sll_spec.rb
@@ -0,0 +1,175 @@
+require_relative '../sll'
+
+describe SinglyLinkedList do
+ let(:list) { list = SinglyLinkedList.new "1st node" }
+
+
+ describe 'Node.new' do
+ it 'should create a new node' do
+ list = SinglyLinkedList.new 'head'
+ expect(list.head.value).to eq('head')
+ expect(list.head.next).to be_nil
+ end
+ end
+
+ describe '.new' do
+ it 'creates a list with no start value' do
+ list = SinglyLinkedList.new
+ expect(list).to be
+ expect(list.head).to be_nil
+ end
+
+ it 'creates a list with a start value' do
+ list = SinglyLinkedList.new "1st node"
+ expect(list).to be
+ expect(list.head).to_not be_nil
+ end
+ end
+
+ describe '#first' do
+ it 'returns the head node' do
+ expect(list.first).to eq(list.head)
+ end
+ end
+
+ describe '#append' do
+ it 'adds a node to the end of the list' do
+ list.append('2nd node')
+ expect(list.head.value).to eq('1st node')
+ expect(list.head.next.value).to eq('2nd node');
+ end
+ end
+
+ describe '#last' do
+ it 'returns the last node' do
+ list.append('2nd node')
+ expect(list.last.value).to eq('2nd node')
+ end
+ end
+
+ describe '#length' do
+ it 'returns length 1' do
+ expect(list.length).to eq(1)
+ end
+
+ it 'returns length 2' do
+ list.append('2nd node')
+ expect(list.length).to eq(2)
+ end
+ end
+
+ describe '#size' do
+ it 'returns size 1' do
+ expect(list.size).to eq(1)
+ end
+
+ it 'returns size 2' do
+ list.append('2nd node')
+ expect(list.size).to eq(2)
+ end
+ end
+
+ describe '#count' do
+ it 'returns count 1' do
+ expect(list.count).to eq(1)
+ end
+
+ it 'returns count 2' do
+ list.append('2nd node')
+ expect(list.count).to eq(2)
+ end
+ end
+
+ describe '#prepend' do
+ it 'creates a new head node from a 1 node list' do
+ node2 = list.head
+ list.prepend('new head')
+ expect(list.head.value).to eq('new head')
+ expect(list.head.next).to be(node2)
+ end
+
+ it 'creates a new head node from a 0 node list' do
+ list = SinglyLinkedList.new
+ list.prepend('new head')
+ expect(list.head.value).to eq('new head')
+ expect(list.head.next).to be_nil
+ end
+ end
+
+ describe '#find' do
+ it 'searches for the first node' do
+ node1 = list.find '1st node'
+ expect(node1.value).to eq('1st node')
+ end
+
+ it 'searches for a nonexistent node' do
+ node = list.find 'nosuchnode'
+ expect(node).to be_nil
+ end
+
+ it 'searches for the second node' do
+ node2 = list.append('2nd node')
+ nodeFound = list.find '2nd node'
+ expect(node2).to be(nodeFound)
+ end
+ end
+
+ describe '#reverse' do
+ it 'reverses a single node list' do
+ reversed = list.reverse
+ # why does this fail?
+ expect(reversed.head).to eq(list.head)
+ # expect(reversed.head.value).to eq(list.head.value)
+ end
+
+ it 'reverses a list with 2 nodes' do
+ list.append('2nd node')
+ reversed = list.reverse
+ expect(reversed.head.value).to eq('2nd node')
+ expect(reversed.head.next.value).to eq('1st node')
+ end
+ end
+
+ describe '#reverse!' do
+ it 'returns single node list' do
+ reversed = list.reverse!
+ expect(reversed).to be(list)
+ end
+
+ it 'reverses and replaces a list with 2 nodes' do
+ list.append '2nd node'
+ list.reverse!
+ expect(list.head.value).to eq('2nd node')
+ expect(list.head.next.value).to eq('1st node')
+ end
+
+ it 'reverses and replaces a list with 3 nodes' do
+ list.append '2nd node'
+ list.append '3rd node'
+ list.reverse!
+ expect(list.head.value).to eq('3rd node')
+ expect(list.head.next.value).to eq('2nd node')
+ expect(list.head.next.next.value).to eq('1st node')
+ end
+ end
+
+ describe '#each' do
+ it 'prints a 3 node list' do
+ list.append '2nd node'
+ list.append '3rd node'
+ list.each do |node|
+ expect( print(node.value) ).to output('1st node').to_stdout
+ end
+
+ end
+ end
+
+ describe '#map' do
+ it 'adds "yay" to the value of each node in the list' do
+ list.append '2nd node'
+ list.append '3rd node'
+ map = list.map {|node| "#{ node.value } yay" }
+ puts "#{ map.head.value } #{ map.head.next.value} #{ map.head.next.next.value }"
+ end
+ end
+end
\ No newline at end of file
diff --git a/TimothyTsui/week_11/singly_linked_list/spec/spec_helper.rb b/TimothyTsui/week_11/singly_linked_list/spec/spec_helper.rb
new file mode 100644
index 0000000..25dc80a
--- /dev/null
+++ b/TimothyTsui/week_11/singly_linked_list/spec/spec_helper.rb
@@ -0,0 +1,96 @@
+# This file was generated by the `rspec --init` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# The `.rspec` file also contains a few flags that are not defaults but that
+# users commonly want.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # These two settings work together to allow you to limit a spec run
+ # to individual examples or groups you care about by tagging them with
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
+ # get run.
+ config.filter_run :focus
+ config.run_all_when_everything_filtered = true
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ config.disable_monkey_patching!
+
+ # This setting enables warnings. It's recommended, but in some cases may
+ # be too noisy due to issues in dependencies.
+ config.warnings = true
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = 'doc'
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end
diff --git a/TimothyTsui/week_11/yegge-interview-screening/index.html b/TimothyTsui/week_11/yegge-interview-screening/index.html
new file mode 100644
index 0000000..5c1afda
--- /dev/null
+++ b/TimothyTsui/week_11/yegge-interview-screening/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Document
+
+
+
Please open the console to see the output
+
+
+
+
\ No newline at end of file
diff --git a/TimothyTsui/week_11/yegge-interview-screening/js/ex1.js b/TimothyTsui/week_11/yegge-interview-screening/js/ex1.js
new file mode 100644
index 0000000..eab39d5
--- /dev/null
+++ b/TimothyTsui/week_11/yegge-interview-screening/js/ex1.js
@@ -0,0 +1,126 @@
+// 1. Write a function to reverse a string.
+var reverseString = function(str) {
+ var reversed = "";
+ for (var i = str.length - 1; i >= 0; i--){
+ reversed += str[i];
+ }
+ console.log(reversed);
+ return reversed;
+};
+
+// 1b. Write a function to reverse an array
+var reverseArray = function(arr) {
+ for (var i = 0; i < Math.floor(arr.length / 2); i++) {
+ var tmp = arr[i];
+ arr[i] = arr[arr.length - 1 - i];
+ arr[arr.length - 1 - i] = tmp;
+ }
+ console.log(arr);
+ return arr;
+};
+
+// 2. Write function to compute Nth fibonacci number:
+var fib = function(n) {
+ if (n === 1 || n === 2) {
+ return 1;
+ }
+ var iterations = n - 2;
+ var a = 1, b = 1;
+ for (var i = 0; i < iterations; i++) {
+ var tmp = a + b;
+ a = b;
+ b = tmp;
+ }
+ return b;
+};
+
+// 3. Print out the grade-school multiplication table up to 12x12
+var timesTable = function() {
+ for (var i = 0; i <= 12; i++) {
+ var str = "";
+ for (var j = 0; j <= 12; j++) {
+ str = str + " " + pad(i * j, ' ');
+ }
+ console.log( str );
+ }
+};
+
+// helper function that pads string with spaces so that timesTable is nicely formatted
+var pad = function(str, padVal) {
+ return String(padVal + str).slice(-padVal.length);
+}
+
+// 4. Write a function that sums up integers from a text file, one int per line.
+var fileNode = document.getElementById('fileUpload');
+fileNode.addEventListener('change', function() {
+
+ var file = fileNode.files[0];
+ var reader = new FileReader();
+ reader.onload = function(e) {
+ var data = e.target.result;
+ var lines = data.split('\n');
+ var sum1 = lines.reduce( function(sum, line) {
+ var num = parseInt(line) || 0;
+ return sum + num;
+ }, 0);
+ console.log('lines ' + lines.length, 'sum ' + sum1);
+ };
+ reader.readAsText(file);
+});
+
+// 5. Write function to print the odd numbers from 1 to 99.
+var printOdd = function() {
+ var nums = "";
+ for (var i = 1; i < 100; i += 2) {
+ nums = nums + i + " ";
+ }
+ console.log(nums);
+}
+
+// 6. Find the largest int value in an int array.
+var maxInt = function(arr) {
+ // method 1
+ // return arr.reduce(function(max, num) {
+ // return max > num ? max : num;
+ // });
+
+ // method 2
+ // if (arr.length === 0) { return NaN; }
+ // var max = arr[0];
+ // for (var i = 1; i < arr.length; i++){
+ // if (arr[i] > max) {
+ // max = arr[i];
+ // }
+ // }
+ // return max;
+
+ // method 3
+ return Math.max.apply(null, arr);
+};
+
+// 7. Format an RGB value (three 1-byte numbers) as a 6-digit hexadecimal string.
+var rgb2hex = function(r, g, b) {
+ var r2hex = r.toString(16);
+ var g2hex = g.toString(16);
+ var b2hex = b.toString(16);
+ return pad(r2hex, "00") + pad(g2hex, "00") + pad(b2hex, "00");
+};
+
+array = "hello".split('');
+console.log(array);
+reverseArray(array);
+reverseString("hello");
+
+var fibSeq = "";
+for (var i = 1; i < 10; i++){
+ fibSeq = fibSeq + " " + fib(i);
+}
+console.log(fibSeq);
+
+timesTable();
+
+printOdd();
+
+console.log(maxInt([10, 1, 3, 11, 2]));
+
+console.log(rgb2hex(255,0,0));
\ No newline at end of file
diff --git a/TimothyTsui/week_11/yegge-interview-screening/sample.txt b/TimothyTsui/week_11/yegge-interview-screening/sample.txt
new file mode 100644
index 0000000..b4a776a
--- /dev/null
+++ b/TimothyTsui/week_11/yegge-interview-screening/sample.txt
@@ -0,0 +1,3 @@
+1
+4
+12