This file contains hidden or 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
| const fs = require('fs'); | |
| const path = require('path'); | |
| module.exports = Id =(() => { | |
| let lastId= 0; | |
| return class ShortenedLink { | |
| constructor(url, cutUrl){ | |
| this.id = ++lastId | |
| this.url = url; |
This file contains hidden or 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 TABLE car_photos; | |
| -- DROP TABLE cars; | |
| CREATE TABLE cars ( | |
| car_id INT AUTO_INCREMENT PRIMARY KEY NOT NULL, | |
| model_year SMALLINT NOT NULL, | |
| make VARCHAR(80) NOT NULL, | |
| model VARCHAR(90) NOT NULL, | |
| miles INTEGER NOT NULL, |
This file contains hidden or 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
| const mysql = require('mysql2/promise'); | |
| const pool = mysql.createPool({ | |
| host: 'localhost', | |
| port: 3306, | |
| user: 'admin', | |
| password: 'hello', | |
| database: 'es_starter' | |
| }); //maybe should be const options |
This file contains hidden or 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
| static deleteById(id) { | |
| return db.query('DELETE FROM cars WHERE car_id = ?', [id]) | |
| } //method I'm trying to get working | |
| static fetchAll () { | |
| const options = { | |
| sql: | |
| "SELECT c.car_id, c.model_year, c.make, c.miles, c.color, c.transmission, c.layout, c.engine_type, p.car_id, p.car_photo_url FROM cars c INNER JOIN car_photos p ON c.car_id = p.car_id", | |
| nestTables: true |
This file contains hidden or 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
| exports.postAddVehicle = (req, res, next) => { | |
| const model_year = req.body.model_year; | |
| const make = req.body.make; | |
| const model = req.body.model; | |
| const color = req.body.color; | |
| const miles = req.body.miles; | |
| const transmission = req.body.transmission; | |
| const layout = req.body.layout; | |
| const engine_config = req.body.engine_config; | |
| const car_photo_url = null; |
This file contains hidden or 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
| user@pop-os:~/Documents/03-More-React-Hooks-useContext-useReducer-useCallback-useMemo/clip04-Updating-Example-To-Full-Conf-Site$ npm installnpm WARN deprecated mkdirp@0.5.3: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) | |
| npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. | |
| npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. | |
| npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated | |
| npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated | |
| > @ampproject/toolbox-optimizer@2.6.0 postinstall /home/user/Documents/03-More-React-Hooks-useContext-useReducer-useCallback-useMemo/clip04-Updating-Example-To-Full-Conf-Site/node_modules/@ampproject/toolbox-optimizer | |
| > node lib/warmup.js | |
| Browserslist: caniuse-lite is outdate |
This file contains hidden or 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 ImageToggleOnMouseOver from "../src/ImageToggleOnMouseOver"; | |
| const ImageChangeOnMouseOver = () => { | |
| return ( | |
| <div> | |
| <ImageToggleOnMouseOver | |
| primaryImg="/static/speakers/bw/bmwFiverbw.jpg" | |
| secondaryImg="/static/speakers/bmwFiver.jpg" | |
| alt="" /> |
This file contains hidden or 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, { Component } from "react"; | |
| import "./Pokecard.css"; | |
| /*important variables */ | |
| //const POKE_API = 'https://assets.pokemon.com/assets/cms2/img/pokedex/detail/'; | |
| //let padToThree = (number) => (number <= 999 ? `00${number}`.slice(-3): number); | |
| //let imgSrc = `${POKE_API}${padToThree(props.id)}.png`; | |
| /*end of important variables */ |
This file contains hidden or 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
| body{ | |
| font-family: Helvetica; | |
| } | |
| .nav { | |
| width: 100%; | |
| height: 5%; | |
| display: inline-grid; | |
| grid-template-columns: 20% 1fr 1fr 1fr 20%; | |
| } |
This file contains hidden or 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
| #CarItem model | |
| class CarItem < ApplicationRecord | |
| belongs_to :model_info | |
| end |
NewerOlder