- Fruit = 1-2 servings
- Animal protein = 4 - 6 servings
- Healthy fats = 5 - 9 servings
- Healthy vegetables = 6 - 11 servings
- Healthy fats = 50%
| defaults delete ~/Library/Preferences/com.teamviewer.teamviewer9.plist | |
| defaults delete ~/Library/Preferences/com.teamviewer.teamviewer9.Machine.plist | |
| sudo defaults delete /Library/Preferences/com.teamviewer.teamviewer9.plist | |
| rm -f ~/Library/Preferences/com.teamviewer.teamviewer9.plist | |
| rm -f ~/Library/Preferences/com.teamviewer.teamviewer9.Machine.plist | |
| sudo rm -f /Library/Preferences/com.teamviewer.teamviewer9.plist |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |
| require 'singleton' | |
| class User | |
| include singleton | |
| end | |
| >> User.instance | |
| => #<User:0x007fe75492fea8> | |
| >> User.instance | |
| => #<User:0x007fe75492fea8> |
| class User | |
| def self.new(accesscode) | |
| @cache ||= {} | |
| @cache[accesscode] ||= super(accesscode) | |
| end | |
| def initialize(accesscode) | |
| @accesscode = accesscode | |
| end | |
| end |
| require 'barby' | |
| require 'barby/barcode/code_128' | |
| require 'barby/outputter/png_outputter' | |
| require 'mini_magick' | |
| require 'benchmark' | |
| # Build a sample barcode | |
| def build_barcode(prod, supplier_code, batch_no) | |
| bar_code = prod + "-" + supplier_code + "-"+ batch_no | |
| bar_code_image = bar_code.delete("/") # Clear all /'s in the code if any .. |
| # app/controllers/api/v1/stockins_controller.rb | |
| module Api | |
| module V1 | |
| class StockinsController < ActionController::Base | |
| before_filter :restrict_access | |
| respond_to :json | |
| def index | |
| respond_with Stockin.all | |
| end |
| # To be written | |