Skip to content

Instantly share code, notes, and snippets.

@Penitent0
Last active August 20, 2022 19:47
Show Gist options
  • Save Penitent0/c0752becbcf81f3c6bdcb1e31e6860fe to your computer and use it in GitHub Desktop.
Save Penitent0/c0752becbcf81f3c6bdcb1e31e6860fe to your computer and use it in GitHub Desktop.
Ken Lenhart - Intermission Work

B2 Intermission Work

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

HTML

  1. What is HTML?

Hypertext Markup Language - Markup language for describing structure and format of Web pages.

  1. What is an HTML element?

HTML elements are defined by a start tag, some content, and an end tag - header elements, paragraph elements, and body elements are examples. Elements can be empty. Elements but be closed with an end tag.

  1. What is an HTML attribute?

Attributes provide additional information for HTML elements - Attributes are defined in the element start tag. Attributes can be the style of an element, the height and width of an image, or the langauge of a Web page. Attributes usually use a name/value pair such: name="value"

  1. What is the difference between a class and an id? When would you use one vs. the other?

ID attributes can only be used by one HTML element within a page while Class attributes may be used by multiple elements within a page. Class attributes could be used by multiple related elements that require similair styling. An ID attribute could be used for an individual element that requires unique attributes.

  1. What HTML would you write to create a form for a new dog with a "name" and an "age"?
New Dog Name:

New Dog Age:

  1. What are semantic tags? When would you use them over a div?

Semantic tags specify their meaning to the browser and the user. You would use them when you want to clearly communicate the content of an element.

  1. Explain what each of the following HTML tags do and when you would use them:
  • <h1>, <h2>, etc. - Headings used to display titles or subtitles on page. Important to articulate document structure to users and to search engines.
  • <p> - Paragraph element used to define a block of text. Provides consistent formatting for text regardless of window or screen size.
  • <body> - Defines visible part of HTML document. All elements to be displayed on page must be contained within body tags.
  • <a> and the href attribute - Tags used to define hyperlink and the URL of the page that link goes to. Used when you want to display a hyperlink on a Web page.
  • <img> and the src attribute - Tages used to embed image into page and to specify the path to the image to be displayed. Used when you want to embed an image into a Web page.
  • <div> - Block element usually used to contain other elements and takes up the full width available.
  • <section> - Defines a section in a document, supports global and event attributes in HTML.
  • <ul>, <ol>, and <li> - Defines unordered lists, ordered lists, and list items.
  • <form> - Tag used as a container to collect and define different types of input elements.
  • <input> - Tag used inside form tags to specify type of input to collect.

CSS

  1. What is CSS?

Stands for cascading style sheets. Describes how HTML elements will be displayed.

  1. What is a CSS selector? How do you use the ID selector? The class selector?

Selects the HTML element to be styled. ID selectors are used with hash (#) and the id of the element. Class selectors are used with the period (.) and the name of the Class.

  1. What are the three ways to include CSS in your HTML documents? What are the pros and cons of each?

CSS can be included using External CSS, Internal CSS, or Inline CSS. External CSS requires a .css file to be created and included in the HTML page to be styled but can be used on multuple pages. Internal CSS is defined by the style tag within a single HTML page. Inline CSS is applied to a single element within an HTML page.

  1. What is the Box Model? Describe each component of the Box Model.

A box that wraps around every HTML element. The components are - Margins: Transparent buffer area outside of border. Border: Border that wraps around padding and content. Padding: Transparent buffer area between border and content. Content: Where text and images appear inside of the box.

SQL

Jumpstart Lab Tutorial

  1. What is a database?

A means of storing, fetching, calculating, and sorting data

  1. What is SQL?

Structured Query Language

  1. What is SQLite3?

Database engine built into MacOS

  1. What is a Table?

Database object that contains all of the data in a database

  1. What is a primary key?

Unique identifier for each column or row in a table

  1. What is a foreign key?

Column or columns used to create link between two tables

  1. Explain what each of the following SQL commands do:
  • insert - Adds data into table
  • select - Used to find rows in a table
  • where - Used with SELECT to limit returned rows only to those that match the specified attributes
  • order by - Used with SELECT to sort data by attribute or attributes given
  • inner join - Used to create new table composed from attributes of two or more tables

PG Exercises

  1. How can you limit which columns you select from a table?

Using SELECT

  1. How can you limit which rows you select from a table?

Using SELECT and WHERE

  1. How can you give a selected column a different name in your output?

Using CASE and AS

  1. How can you sort your output from a SQL statement?

Using ORDER BY

  1. What is joining? When do you need to join?

Used to combine two or more tables based on related column between them. Useful when you need to combine values from two different tables

  1. What is an aggregate function?

Function that performs calculations on multiple values and returns an aggregated value

  1. List three aggregate functions and what they do.

MAX - returns highest value of selected column, MIN - returns lowest value fo selected column, AVG - returns average of values in selected column

  1. What does the group statement do?

Used to batch data together intro groups and run aggregation function on each group

  1. How does the group statement relate to aggregates?

Group By is used with aggregate functions like SUM, COUNT, and MAX to group results by one or more columns

Rails Tutorial: Task Manager

Copy and Paste the link to your Task Manager repo here: https://github.com/Penitent0/task_mananger Copy and Paste the link to your Static Challenge here: https://github.com/Penitent0/static_challenges

  1. Define CRUD.

Create, Read, Update, Delete/Destroy

  1. Define MVC.

Model-View-Controller

  1. 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, app/controllers/tasks_controller.rb, app/views/tasks/index.html.erb **

  1. What are params? Where do they come from?

params is a hash object created by Rails automatically

  1. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task?

The routes point to two different methods inside the tasks controller. Creating a task creates a new task with a new id. Editing a task requires accessing the id of a previously created task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment