This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- How many people work in the Sales department? | |
SELECT | |
COUNT(e.id) | |
FROM | |
employee e | |
JOIN | |
department d | |
ON e.department = d.id | |
WHERE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './App.css'; | |
function ValidationMessage(props) { | |
if (!props.valid) { | |
return( | |
<div className='error-msg'>{props.message}</div> | |
) | |
} | |
return null; |