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
• Learned about GitHub and how important it is for coders. | |
• Swiping up with 4 fingers shows all desktops open. Swiping left or right switches between the desktops. | |
• Chrome is preferred over Safari, even by Mac users. | |
Terminal commands: | |
ls Lists contents of current directory | |
cd <name> Changes directory to one specified by name | |
cd .. Goes to previous directory (parent directory) | |
cd ~ Goes to home directory | |
control + l Clears terminal window |
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
Repository: a folder/directory with a Git monitoring it. | |
git remote add origin https://github.com/TheAlacrity/git-story.git Bash command that creates the address for git-story repository. | |
git push origin master Bash command that sends the repository to GitHub. | |
After git init, make changes, git add --all, git commit -m "message of changes", git remote add origin URL, git push origin master, make changes, git add --all, git commit -m "message", git push origin master...etc. | |
Rubyists prefer interpolation to concatenation for creating strings. Interpolation | |
Hash, Array, are classes in ruby. A class is a combination of what an object can do (behaviors) and what an object is (attributes). |
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
Week 1, Day 3 | |
Reader methods are used to access instance variables. | |
Instance variables are contained to a particular instance of an object (e.g. *that* chair; not chairs in general). | |
Objects are combinations of attributes and behaviors. Behaviors in Ruby are methods. | |
Reader methods (getter methods); writer methods (setter methods). | |
r + tab in sublime will add the attr_reader method (e.g. attr_reader :first_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
Week 1, Day 4.txt | |
composition (if it's a class), module (if not a class)--a list of behaviors to mix in to other classes, mix ins (act of using module) | |
Modules can be very useful for creating DRY code (removes redundancy of code) | |
Since modules are a list of behaviors, some coders believe it should not include redundant initialize method attributes (however, some coders do include the initialize method). An alternative is to create a parent class with initialize that includes the module of behaviors, then have the subclasses inherit from the parent class. | |
Ex: |
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
Week 2, Day 1.txt | |
Main subject: APIs and the web | |
How does the web work?--Starts with a web request (where you type in the URL). Sends message from our computer through a series of tubes to the server. | |
http = hypertext transfer protocol | |
Responds primarily with html, css, and javascript (only responses from a web request) |
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
Week 2, Day 2 | |
Main subject: Rails | |
Rails is a framework for Ruby that is designed for building websites faster. | |
Ruby was made in 1995 by Someone Matsumoto. A man named David Henemeier Hansson (github.com/dhh <-- He goes by DHH) built Rails in 2005. (He did not create github. Github does run off of Rails, however.) Hulu, AirBnB, and some other famous applications all run on Rails. | |
"If anyone tells you that Rails does not do big applications, they are lying." -Josh Nixon, circa 2019 |
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. WEB REQUEST WINDOW ORDER | |
2. API ROUTE DESKTOP CHROME SUBLIME TERMINAL SLACK | |
3. API CONTROLLER (gets data from MODEL) <-- subject for today | |
4. JSON VIEW | |
5. WEB RESPONSE | |
All Rails apps come pre-git init | |
rails new cookbook_app | |
cd cookbook_app | |
rake db:create | |
rails generate controller api/recipes <--recipes must be plural because all controller names must be plural |
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
string is the default for data type when creating attributes for a model | |
rails generate model Product name price:integer image_url description <-- all attributes of model Product will be strings except price (integer) | |
1. WEB REQUEST WINDOW ORDER | |
2. API ROUTE DESKTOP CHROME SUBLIME TERMINAL SLACK | |
3. API CONTROLLER (gets data from MODEL) <-- subject for today | |
4. JSON VIEW | |
5. WEB RESPONSE |
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
params is a hash | |
@message = params[:message_1] | |
the syntax for adding key value pairs using params is URL?key=value&key=value&key=value&key=value <- this would create 4 key value pairs | |
e.g. http://localhost:3000/api/query_params?my_message=jimm&message_2=i meant jimmy&message_3=that's better | |
g <--abbreviation for generate in rails | |
c <--abbreviation for console in rails | |
s <--abbreviation for server in rails |
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
http://localhost:3000/strawberry-pie Examples of possible URLs we have worked with | |
http://localhost:3000/api/recipe/strawberry-pie Command C will default to copying the line if nothing is highlighted. | |
http://localhost:3000/api/cookbook/3/recipes/4 | |
http://localhost:3000/api/recipes/4 <-- Example of "restful routing" | |
http://localhost:3000/api/4 | |
GET /photos photos#index display a list of all photos | |
GET /photos/new photos#new return an HTML form for creating a new photo | |
POST | |
GET |
OlderNewer