Skip to content

Instantly share code, notes, and snippets.

View johnayoung's full-sized avatar

John Young johnayoung

View GitHub Profile
function getTokens(rawString) {
// This first function does the following things:
// - Takes a raw string
// - Converts the entire string to lowercase
// - Splits all words into an array that do not match a single character specified between the []
// - Removes falsy items
// - Sorts the array of strings in place
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort();
}
@johnayoung
johnayoung / tech-eval-notes.md
Last active November 7, 2018 14:48
Notes to prepare for the Thinkful tech evaluation

HTML

Front-end first steps

  • Creating HTML and CSS files, and linking to a CSS file inside of HTML
  • Structuring a simple project folder
  • Using VS Code to create and edit files
  • Inserting the boilerplate code that all HTML pages need

HTML the right way

  • Describing the difference between HTML elements, tags, and attributes
  • Explaining what is meant when people say HTML is about structure (vs. presentation or behavior)
#Convert JSON file to an object
$JsonParameters = ConvertFrom-Json -InputObject $content
#Create new PSObject with no properties
$oData = New-Object PSObject
#Loop through properties of the $JsonParameters.parameters object, and add them to the new blank object
$JsonParameters.parameters.psobject.Properties.Name |
ForEach{
Add-Member -InputObject $oData -NotePropertyName $_ -NotePropertyValue $JsonParameters.parameters.$_.Value
@johnayoung
johnayoung / john-jordan-in-your-own-words.md
Created December 4, 2018 16:50
John Young and Jordan Heffernan 'In your own words' exercise.

1. What is scope? Your explanation should include the idea of global vs. local scope

Scope is part of the reasoning of how code works in regards to variables. Global scope allows accessing variables everywhere, whereas local scope is bound to the block at which it is defined.

2. Why are global variables avoided?

Global variables are avoided to prevent unintended side effects.

3. Explain JavaScript's strict mode

'use strict';
// Request and response object drills
// ==================================
const express = require('express');
const app = express();
// use express middleware to parse the request body and add it to the request object
// don't worry, you'll learn all about middleware in the next assignment!
'use strict';
const express = require('express');
// you'll need to use `queryString` in your `gateKeeper` middleware function
const queryString = require('query-string');
const app = express();
// For this challenge, we're hard coding a list of users, because

Get All

db.restaurants.find()

Limit and Sort

db.restaurants.find().sort({name: 1}).limit(10)

Get by id