Skip to content

Instantly share code, notes, and snippets.

View ebectar's full-sized avatar

Alyssa Ebert ebectar

  • Actively seeking opportunites
  • Denver, CO
View GitHub Profile
@ebectar
ebectar / deploy-react-surge.md
Last active September 24, 2024 19:10
How to deploy a create-react-app to Surge

Deploying a React app with Surge (from Create React App format)

1. Make sure you have surge installed globally

  • npm install -g surge

2. Run the Create React App build

  • cd your-react-project
  • npm run build

Setting up a new project using SaSS with gulp-sass

Prereqs

  • Install SaSS npm install -g sass
  • Install gulp npm install -g gulp

Create a new project

  • Navigate into directory
  • Initalize new package.json npm init
  • Create dependencies for gulp and gulp-sass npm install --save-dev gulp gulp-sass

Cook My Pantry

Project Description

Cook My Pantry is a mobile app that will give users an easy way to find recipes based on the ingredients in their pantry

Problem Statement

Often when you find yourself in the mood to cook, you can only find recipes that would require a trip to the grocery store. However, more likely than not, your pantry contains plenty of ingredients to create a delicious dish.

How will your project solve the problem?

This app will give users the ability to filter online recipes that only contain items they currently have in their pantry. They won't have to make an extra trip to the store and have the opportunity to use ingredients they may not cook with very often.

- press "i"
- write your merge message
- press "esc"
- write ":wq"
- then press enter
**Primary Key** - must be unique, something that is not reproduced anywhere else in a table; can be used to reference this table in other tables
**Foreign Key** - key used from another table
**table relationships**
- 1 to 1 (character to wand)
- 1 to many (character can only be in one house, house can have many characters)
- many to many (characters to books, character in multiple books, one book has multiple characters)
**Entity Relationship Diagram**
______________________________
const apiUrl = ''
fetch('apiUrl')
.then(response => response.json())
.then(data => console.log(data))
  • GIT INIT IN VERSION-X REPO
  • heroku create PAGENAME
  • git add .
  • git commit -m "HEROKU PUSH"
  • git push -u heroku master
  • heroku addons:create heroku-postgresql
  • heroku run knex migrate:latest
  • heroku run knex seed:run
exports.up = function(knex, Promise) {
return knex.schema.createTable('tablename', function(table) {
// TABLE COLUMN DEFINITIONS HERE
table.increments()
table.string('colname1', 255).notNullable().defaultTo('')
table.string('colname2', 255).notNullable().defaultTo('')
table.string('colname3', 255).notNullable().defaultTo('')
table.timestamps(true, true)
// OR
// table.dateTime('created_at').notNullable().defaultTo(knex.raw('now()'))

Knex CRUD commands

LIST

select * from allergies

knex('allergies')  
 .then(data => {

console.log("SELECT", data)

module.exports = {
development: {
client: 'pg',
connection: 'postgres://localhost/dbname-dev'
},
test: {},
production: {
client: 'pg',
connection: process.env.DATABASE_URL
}