-
Understand how you can take information from your database and display it to your users
-
Create a has_many relationship in your application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select name="state"> | |
<option value="AL">Alabama</option> | |
<option value="AK">Alaska</option> | |
<option value="AZ">Arizona</option> | |
<option value="AR">Arkansas</option> | |
<option value="CA">California</option> | |
<option value="CO">Colorado</option> | |
<option value="CT">Connecticut</option> | |
<option value="DE">Delaware</option> | |
<option value="DC">District Of Columbia</option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Rails CRUD Operations | |
### Goals | |
1. Implement all the basic CRUD Operations (7 actions) for a Rails resource | |
### Assignment | |
***This homework assignment requires that you build upon your existing blog app (from the prior homework assignment)*** | |
In the last homework assignment you were tasked with implementing both an index and show action for the posts resource. During this assignment you will do the following: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Scrabble | |
attr_reader :word | |
def initialize(word) | |
@word = word | |
end | |
def score | |
letters = word.upcase.split('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WordCounter | |
attr_reader :words, :frequency | |
def initialize(content) | |
@words = content.downcase.gsub(/[.,]/, '').split(' ') | |
end | |
def count | |
word_frequency = Hash.new(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1) Create a Robot class | |
#2) add an initialize method that accepts | |
## one attribute "name" | |
#3) Add reader and writer methods (long way) | |
#4) Add a talk method that has the robot say its name | |
#5) Create 3 robots, larry, curly and moe | |
#6) Change curly's name to "shemp" | |
class Robot | |
attr_accessor :name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
numbers = (1..9999).to_a.shuffle << 9999 | |
def find_duplicate_hash_store(numbers_array) | |
checked_numbers = {} | |
numbers_array.each do |number| | |
return number if checked_numbers[number] != nil | |
checked_numbers[number] = number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given an array of n numbers with exactly one duplicate, write a program that finds the duplicate number in an efficient manner | |
require 'minitest/autorun' | |
def find_duplicate(numbers_array) | |
# using an hash as a way to keep track of evaluted numbers | |
checked_numbers = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given an array of n numbers with exactly one duplicate, write a program that finds the duplicate number in an efficient manner | |
require 'minitest/autorun' | |
def find_duplicate(numbers_array) | |
# using an array as a way to keep track of evaluted numbers | |
checked_numbers = [] |
NewerOlder