- Unit testing == testing small things like methods/classes
- Integration testing == drives you towards TDD
- go to ruby-gems to find the latest version of a gem you are using
- when calling
'~>x.x.y
on gem it accepts any version withx.x.
y can be anything - expect ()- when you have an output your expecting from the obj being tested
- expect {}- when you have a side effect of running your code
- need selenium or phantom js to test ajax calls in your app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parse and Count problem | |
require 'pathname' | |
def scan(path) | |
file = File.open(path).each_line do |line| | |
line.split.each do |word| | |
word = word.gsub(/[.,()?"]/, "") | |
if @word_hash[word] | |
@word_hash[word] += 1 | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Front END Problem --> | |
<!DOCTYPE html> | |
<body id='body'> | |
<div class="newDiv"id="myDiv">Hello, World</div> | |
</body> | |
<style type="text/css"> | |
#myDiv { | |
text-align: center; | |
background: #33cc33 |
- Is creating a new resource :something in router best practice if you're only using 2 of the RESTful routes (ie: user authentication?
- where should partials be saved if they're used across different view folders?
- A- where ever you want, though you have to specify the path (ie:'shared/form')
- Create a new rails app in terminal by entering
rails new APPNAME
rake db:setup
runs the following commands:rake db:create
rake db:schema load
*rake db:seed
- good for getting a db env up and running quickly
- Routes == main control center for your app
- place where specify what things your app resonds to and when to find the code to run
- Instead of writing routes in your controller, write methods
- All of your controllers should inherit from ApplicationController
Write better code in less time by Evan Dorn Link to video
- Caveat #1- Intelligence is a liability when trying to write good software.
- Smart people can make progress, without proper PROCESS
- Not a good thing when trying to deliver high quality software and working in large teams
- Analogous to a builder saying "We know how skyscrapers work, just give us the bricks and we'll get started."
- Successful Professionals (across all fields)
More about configuring your Rails databases: --> http://guides.rubyonrails.org/configuring.html#configuring-a-database
More info on rails forms: --> http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for
Rails partials/ rendering: --> http://guides.rubyonrails.org/layouts_and_rendering.html
Active Record assosciations:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BoggleBoard | |
def initialize(boggle_board) | |
@boggle_board = boggle_board | |
end | |
def create_word(*coords) | |
coords.map { |coord| @boggle_board[coord.first][coord.last]}.join("") | |
end |
NewerOlder