Skip to content

Instantly share code, notes, and snippets.

View verdi327's full-sized avatar
💭
Thinkful EI

Michael Verdi verdi327

💭
Thinkful EI
View GitHub Profile
function quickSort(arr, start=0, end=arr.length) {
if (start >= end) {
return arr;
}
let pivot = partition(arr, start, end);
arr = quickSort(arr, start, pivot);
arr = quickSort(arr, pivot+1, end);
return arr;
}
function mergeSort(arr) {
if (arr.length <= 1) {
return arr;
}
let middle = Math.floor(arr.length/2);
let left = mergeSort(arr.slice(0, middle));
let right = mergeSort(arr.slice(middle));
return merge(left, right);
@verdi327
verdi327 / static_deploy_questions.txt
Created May 29, 2019 21:04
Thinkful Static Deploy
Name of your app
Bettr
Link to live static version
https://bettr-fit.now.sh
Link to repo on GitHub
https://github.com/verdi327/bettr-client
The user feedback you collected
@verdi327
verdi327 / thinkful-auth-questions.txt
Created May 16, 2019 14:28
Thinkful Auth Questions
1) Should the client or the server take more security precautions?
The server.
What's the difference between local storage and session storage?
Session storage only exists for as long as the tab is open. Local storage persists across multiple tabs, but not across multiple windows.
What problem does a JWT expiry time solve?
Using expiring tokens means that a malicious user cannot indefinitely act as you. The token will eventually expire and valid user must login again.
Is a refresh endpoint protected or public?
Thingful Client
Interesting how context was setup. A class was created that held all of the funtions and state updates. The render function returns the provider wrapper child elements.
App Layout
Login Page
Register Page
List Page
Show Page
Not Found (for all other routes)
@verdi327
verdi327 / setup-postgres-on-heroku.txt
Created May 12, 2019 17:06
Setting up Postgres on Heroku
Create Heroku App
-heroku create
Rename Heroku App
-heroku apps:rename <new-name>
Create Heroku Postgres DB
-heroku addons:create heroku-postgresql:hobby-dev
Get DB Credentials
@verdi327
verdi327 / dunder-mifflin-projects.sql
Created May 10, 2019 15:19
Practice Joins Assignment
-- How many people work in the Sales department?
SELECT
COUNT(e.id)
FROM
employee e
JOIN
department d
ON e.department = d.id
WHERE
@verdi327
verdi327 / connect-postgres-to-express-with-knex.txt
Created May 9, 2019 12:44
Connection Postgres to Express with Knex
Install pg, knex, postgrator-cli
npm i pg knex
npm i postgrator-cli -D
Create Dev and Test DB for project
createdb -U <username> <project-name-dev>
createdb -U <username> <project-name-test>
Create Postgrator-cli config file
require('dotenv')
@verdi327
verdi327 / bookmark_db_seed_file.sql
Last active May 6, 2019 17:56
DB Seed File for Bookmarks
DROP DATABASE if exists bookmark_app_db;
CREATE DATABASE bookmark_app_db;
\c bookmark_app_db;
DROP TABLE if exists bookmarks;
CREATE TABLE bookmarks (
id INTEGER primary key generated by default as identity,
title VARCHAR(100) UNIQUE NOT NULL,
url TEXT UNIQUE NOT NULL,
@verdi327
verdi327 / full-form-validation.js
Created May 2, 2019 20:22
React Form Validation
import React from 'react';
import './App.css';
function ValidationMessage(props) {
if (!props.valid) {
return(
<div className='error-msg'>{props.message}</div>
)
}
return null;