Skip to content

Instantly share code, notes, and snippets.

View stephepush's full-sized avatar

Stephen Peters stephepush

View GitHub Profile
@stephepush
stephepush / passport-tutpsql.sql
Last active January 28, 2020 21:27
passport-tutorial-postgresschema
--
-- PostgreSQL database dump
--
-- Dumped from database version 11.6 (Ubuntu 11.6-1.pgdg19.04+1)
-- Dumped by pg_dump version 12.1 (Ubuntu 12.1-1.pgdg19.04+1)
-- Started on 2020-01-23 11:08:59 EST
SET statement_timeout = 0;
@stephepush
stephepush / gist:4b3be6a317822417cf9402d96bce4d16
Created July 9, 2020 15:17
Rails Console Adding models printout
~/.../PryPress/pry-press-backend // ♥ > rails console
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Running via Spring preloader in process 50251
Loading development environment (Rails 6.0.3.2)
2.6.1 :001 > user1 = User.create(name: "William T. Riker", street_address: "745 Maple lane", zipcode: "22302", isAdmin: false)
(3.7ms) BEGIN
User Create (14.3ms) INSERT INTO "users" ("name", "street_address", "zipcode", "isAdmin", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["name", "William T. Riker"], ["street_address", "745 Maple lane"], ["zipcode", "22302"], ["isAdmin", false], ["created_at", "2020-07-08 19:57:00.031328"], ["updated_at", "2020-07-08 19:57:00.031328"]]
(32.0ms) COMMIT
=> #<User id: 1, n
@stephepush
stephepush / car_item.rb
Created July 30, 2020 19:37
Car dealer Backend Files
#CarItem model
class CarItem < ApplicationRecord
belongs_to :model_info
end
@stephepush
stephepush / index.css
Created August 16, 2020 13:06
CSS that hits a wall
body{
font-family: Helvetica;
}
.nav {
width: 100%;
height: 5%;
display: inline-grid;
grid-template-columns: 20% 1fr 1fr 1fr 20%;
}
@stephepush
stephepush / Pokecard.js
Created February 21, 2021 04:36
Pokedex
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 */
@stephepush
stephepush / ImageChangeOnMouseOver.js
Created February 27, 2021 18:31
Hooks Practice Pluralsight
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="" />
@stephepush
stephepush / nextjs console
Created March 10, 2021 05:03
Nextjs console popos
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
@stephepush
stephepush / adminController.postAddVehicle.js
Created September 13, 2021 02:12
Excluding model/class properties in express
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;
@stephepush
stephepush / carModelExcerpt.js
Created September 26, 2021 03:24
Trying to get deleteById methods to work
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
@stephepush
stephepush / database.js
Created October 8, 2021 02:21
passport.js using mariadb and mysql2
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