Skip to content

Instantly share code, notes, and snippets.

View kylebowen's full-sized avatar

Kyle Bowen kylebowen

View GitHub Profile

React Component Drills 1

navigation-bar.js

import React from 'react';

import './navigation-bar.css';

// The NavigationBar component goes here.  It should be the default export.
export default function NavigationBar(props) {
'use strict';
// // Get all
// db.restaurants.find().pretty();
// // Limit and sort
// db.restaurants.find().
// sort( {name: 1} ).
-- 1 Get all restaurants
SELECT * FROM restaurants;
-- 2 Get Italian restaurants
SELECT * FROM restaurants
WHERE cuisine = 'Italian';
-- 3 Get 10 Italian restaurants, subset of fields
SELECT id, name FROM restaurants
WHERE cuisine = 'Italian'
@kylebowen
kylebowen / thinkful-analyze-most-freq-word.md
Last active May 22, 2018 23:12
Unit 2, Lesson 6, Project 6

Analyze a Most Frequent Word Program

High Level Overview

  1. Split the text input into an array of strings broken down to each individual word.
  2. Create an object to store the usage count of each word.
  3. Loop through the array of words, adding words to the above object and updating usage counts as needed.
  4. Create temp variables to hold the word and usage count of the most frequent word and corresponding usage count with initial values from the first item in the object.
  5. Loop through each pair from the object and update the value of the temp variables when a new most frequent word is found.
  6. When the loop completes, return the resultant word from the temp variable.
@kylebowen
kylebowen / thinkful-object-drills-2.md
Created May 22, 2018 06:39
Unit 2, Lesson 6, Project 5
@kylebowen
kylebowen / thinkful-object-drills-1.md
Created May 21, 2018 22:18
Unit 2, Lesson 6, Project 2
@kylebowen
kylebowen / thinkful-scope-explanation.md
Last active May 21, 2018 18:16
Unit 2, Lesson 5, Project 3

Scope

What is scope?

Scope is the set of rules governing where a variable is valid based on the location of its definition.

Scope can be Global or Local. Any variable defined outside a function (or without the use of let or const)has a global scope and is accessible from anywhere in the program. A variable defined inside a function has a local scope and is only accessible from the context in which it was defined or blocks/functions nested within that context. This concept of nesting scope is referred to as the Scope Chain. Local scope will over-ride global scope. So, a variable defined with local scope can have the same name as a variable with global scope, but the program will treat them as separate variables. The value contained in the variable can't rise above where it was defined in the scope chain. Once the program rises out of the local scope, the code will look for a definition in the new scope and will keep looking in progressively higher parent scopes until it finds one. If the code

@kylebowen
kylebowen / thinkful-arrays-and-loops-drills.md
Created May 18, 2018 04:37
Unit 2, Lesson 4, Project 6
@kylebowen
kylebowen / thinkful-array-method-drills.md
Created May 17, 2018 21:51
Unit 2, Lesson 4, Project 4
@kylebowen
kylebowen / thinkful-array-basics-drills.md
Created May 17, 2018 20:53
Unit 2, Lesson 4, Project 2