Skip to content

Instantly share code, notes, and snippets.

View mzibari's full-sized avatar

mzibari

View GitHub Profile
Role Task Priority
As a new user I want to Register High
As a new user I want to view a demo of the app Medium
As a returning user I want to log in High
As a returning user I want to add items to my grocries High
As a returning user I want to view the items in my grocery High
As a returning user I want to checkout items from my groceries High
As a returning user I want to be notified before an item expires Medium
As a returning user I want to make a grocery list Medium

App name Frugal or My Pantry

This app will be designed to keep a record of the users’ groceries. Users will be able to enter the expiration date, and possibly get notified before expiration (maybe a future iteration will include average shelf life for different products that will be used as a default value). Users also can checkout items as they use it, they can checkout fractions of items. Users will be able to look at what groceries they have while shopping. A possible feature is to make a grocery list. A possible feature is to search for recipes.

How are the syntaxes async and await useful when writing JavaScript code?
It allows for the use of try catch in an asynchronous code
With respect to Knex, how does the transaction method relate to BEGIN and COMMIT syntax in PostgreSQL?
The concept behind the two is the same, a pending transaction that has to be commited. If there is a connection failure, the database will rollback any queries executed on that connection to the pre-transaction state.
What is a "sequence table" in PostgreSQL?
It's a special table created by typing CREATE SEQUENCE name;
It's a umber generator, you can use nextval, currval, and setval to operate on the sequence.
live react app
https://noteful-client-rouge.vercel.app/
api endpoint
https://pacific-plateau-00954.herokuapp.com/
react app github repo
https://github.com/mzibari/noteful-client
api github repo
@mzibari
mzibari / 1.sql
Last active July 15, 2020 02:36
Relationship and schema design assignment
-- How many people work in the Sales department?
SELECT
COUNT(emp_name) AS employees_in_sales
FROM
employee
JOIN
department
ON
employee.department = department.id
WHERE
DROP TYPE IF EXISTS grocery;
CREATE TYPE grocery AS ENUM (
'Main',
'Snack',
'Lunch',
'Breakfast'
);
CREATE TABLE IF NOT EXISTS shopping_list (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
drop table if exists bookmarks;
create table bookmarks (
id integer primary key generated by default as identity,
title text not null,
description text,
rating integer default 1);
insert into bookmarks
(title, description, rating)
values (
https://github.com/mzibari/bookmark-server
What situations would be good to use context?
When more than one component in a deeply nested tree need to access some data in our app, conext will be a good choice.
If you need to pass a prop down 1 or 2 levels, is context necessary?
No, it's not necessary. Applying context makes component's reuse more difficult.
Can you pass a component instance as a prop to avoid the need for context?
Yes you can, this is what's called component composition.
Can you write your own components that accept render props?
@mzibari
mzibari / accordion-drill
Created April 19, 2020 02:51
testing event listeners
<<<<<<ACCORDION.JS>>>>>>
import React from 'react';
class Accordion extends React.Component {
static defaultProps = {
sections: []
}
state = {