Skip to content

Instantly share code, notes, and snippets.

@jamogriff
Forked from mikedao/b2_intermission_work.md
Last active May 7, 2021 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamogriff/146d51d179abbcf95a025c0a7b6cc8ba to your computer and use it in GitHub Desktop.
Save jamogriff/146d51d179abbcf95a025c0a7b6cc8ba to your computer and use it in GitHub Desktop.
B2 Intermission Work Submission

B2 Intermission Work

Answer these Check for Understanding questions as you work through the assignments.

HTML

  1. What is HTML? A markup-based language that provides structure and hierarchy to all webpages.
  2. What is an HTML element? An HTML tag and whatever is inside that particular tag.
  3. What is an HTML attribute? Similar to methods, they change the behavior of an HTML element.
  4. What is the difference between a class and an id? When would you use one vs. the other? Classes can be used for many elements whereas an id is to only be used once.
  5. What HTML would you write to create a form for a new dog with a "name" and an "age"?
<form>
 <input type='text' name='name'>
 <input type='text' name='age'>
 <input type='submit'>
</form>
  1. What are semantic tags? When would you use them over a div? They are more descriptive tags that aid in better SEO for a webpage.
  2. Explain what each of the following HTML tags do and when you would use them:
  • <h1>, <h2>, etc. - Headers for titles
  • <p> - Paragraph for lots of copy.
  • <body> - wrapper that holds the structure for all of a page's content.
  • <a> and the href attribute - link and the hyperlink reference the link points to.
  • <img> and the src attribute - image along with the path to the image
  • <div> - non-descriptive divisor that lends structure for dividing up a webpage.
  • <section> - more descriptive version of div.
  • <ul>, <ol>, and <li> - unordered and ordered lists. li refers to a singular list item.
  • <form> - used to obtain user input that is sent to another resource through GET/POST protocols.
  • <input> - different methods to structure user input (e.g. text, drop-downs or buttons).

CSS

  1. What is CSS? A language often paired with HTML to provide aesthetics and formatting to a webpage.
  2. What is a CSS selector? How do you use the ID selector? The class selector? Its a reference to whatever HTML element is to be altered. The concept is the same for IDs and classes, but the syntax is slightly different.
  3. What are the three ways to include CSS in your HTML documents? What are the pros and cons of each? Inline, which makes sense for small tweaks, but would be impossible to style an entire page. Can also cluster chunks of css at the bottom of each webpage, but this also doesn't scale. The best way would be to have a separate css file that multiple pages reference so branding/formatting stays consistent.
  4. What is the Box Model? Describe each component of the Box Model. Each element is composed of multiple surrounding shells (or boxes) that can be tailored to provide flexible spacing. Padding and margin are the two important ones that provide customized padding and space away from other elements. Border is simply an outside border that is useful for seeing individual elements.

SQL

Jumpstart Lab Tutorial

  1. What is a database? Robust and organized set of data that allows applications a place to store and fetch data.

  2. What is SQL? A standardized language by which we interact with most databases.

  3. What is SQLite3? A database engine based on SQL that's useful for testing, but not deploying apps on.

  4. What is a Table? A thematic and discrete subsection of a database that holds multiple data entries using the same columns.

  5. What is a primary key? Typically a unique ID number that points to a singular row of data.

  6. What is a foreign key? Its a reference to the primary key of another entry in another table. It links data between two tables.

  7. Explain what each of the following SQL commands do:

  • insert - inserts new data entry as a row
  • select - returns rows of data from a table
  • where - adds a conditional statement for what data gets returns
  • order by - returns ordered data when used with a select query
  • inner join - a method to create a new symbolic table to visualize data from two separate tables.

PG Exercises

  1. How can you limit which columns you select from a table? List columns separately, as opposed to using *.
  2. How can you limit which rows you select from a table? By using a where conditional clause that applies a filter to some data.
  3. How can you give a selected column a different name in your output? Using the 'as' keyword.
  4. How can you sort your output from a SQL statement? Use the 'ORDER BY' operator.
  5. What is joining? When do you need to join? Joining is used to produce a combination of data that live in two separate tables. It's used to uncover more hidden relationships.
  6. What is an aggregate function? An aggregate function is a short query that is used to find out information about the data set.
  7. List three aggregate functions and what they do. MAX returns the highest value in a particular column, AVG returns the mean and COUNT returns the count of a particular case.
  8. What does the group statement do? It subdivides rows from a SELECT statement so one can apply aggregate functions to each group.
  9. How does the group statement relate to aggregates? It's typically used in conjunction with aggregates so we can make calculations on each data point when returned en masse.

Rails Tutorial: Task Manager

Task Manager

Static Challenge

  1. Define CRUD. CRUD stands for Create, Read, Update and Delete: these 4 operations are utilized many many times in applications to interact with data.
  2. Define MVC. Model View Controller is a design architecture where controllers intake user input, pass on the request to a model, which then gets passed onto a view where the user receives what they were interested in.
  3. What three files would you need to create/modify for a Rails application to respond to a GET request to /tasks, assuming you have a Task model. config/routes.rb, controllers/tasks, and views/tasks.
  4. What are params? Where do they come from? Params are data in a hash that is passed through a GET/POST request-- typically a form that the user entered information into.
  5. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task? Because an :id doesn't need to exist for creating, but it does for editing. Additionally, the method (GET/PATCH) by which the data is transferred is different.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment