Skip to content

Instantly share code, notes, and snippets.

Project Name

Heading

In one sentence, describe the product in a way the reader (i.e. your target customers) will understand.

Sub-Heading

In one sentence, describe who the market for the product is and what benefit they get.

Summary

> Give a summary of the product and the benefit. Assume the reader will not read anything else so make this paragraph good.

API Documentation

Get /

  • Responds with status code 200 and object {"message": "This is an API"}

GET /tasks

  • Responds with status code 200 and a JSON array of all tasts.

GET /tasks/:id

  • Responds with status code 200 and a JSON object of a single task.
@thuyanduong
thuyanduong / README.md
Last active March 29, 2022 21:15
TLDR Guide to Knew

Quick Guide to Teaching Migrations, Seeds, and Knex

Knex Documentation

How to quickly teach yourself Knex so you can teach others

The goal of this tutorial is to show you know to create a node project and then use knex to create database migrations and seed databases.

Important commands to remember:

@thuyanduong
thuyanduong / README.md
Created January 4, 2022 20:52
Simple OO Neopets

Simple OO Neopets

Neopets are virtual pets that you can play and interact with. The better you take care of them, the happier and healthy they will be!

  1. Create a factory function neopetsFactory() that takes in a name and returns an object.
  2. Objects returned from the function have three data properties, name which is the argument provided, happiness which is initialized to 100 and hunger with is initizlied to 50. There is no min nor max value for happiness and hunger.
  3. Objects returned from the function have three methods: play(), eatVeggies() and eatJunkFood().
  4. play() increases their happiness and also makes them more hungry. This method adds 4 points to happiness and adds 5 points to hunger and returns "Weee!".
  5. eatVeggies() decreases their hunger, but no one enjoys eatting veggies. This method subtracts 6 points from happiness and subtracts 8 points from hunger and returns
@thuyanduong
thuyanduong / README.md
Last active January 4, 2022 20:55
Simple OO Bank Account

Simple OO Bank Account

  1. Create a class Account.
  2. An instance of Account has two data properties, owner which is a string and balance which is a numeric dollar amount.
  3. An instance of Account has three methods: checkBalance, deposit, withdraw.
  4. checkBalance takes no parameters and returns a string int he format <owner> has $<balance> in this account.
  5. deposit takes a single number parameters and adds it to the balance property. It should also return a string in the format "$<amount> was deposited to this account."
  6. withdraw takes a single number parameters and subtracts it to the balance property. It should also return a string in the format "$<amount> was withdrawn from this account."
  7. You should not be allowed to withdraw more than what's in the account, in which case, return "Not enough funds." and do not update the balance property.

Object Oriented Programming (OOP) Study Guide

Here are some additional resources to help you with OOP:

OOP Concepts

  1. Make sure you can correctly and thoughtfully answer each short response question from your Unit 4 Problem Sets.
  2. OOP Interview Questions (the examples are in C++, but the concepts are the same and can be applied to JS)
  3. JavaScript Interview Questions

Coding Question X

Algorithm

X: Great implementation of rotating the array. However, you mutated the original array and the problem says not to.

Code Quality

X: rotatedArray could be declared with const. sft is not the best variable name.

Short Response Question X

Technical

X: You did not explain hoisting, but rather, the result of hoisting. Hoisting is not calling a function before its declaration. Hoisting refers to when JavaScript "moves" certain variables and functions to the top. In actuality, it does this by creating space in memory for all variables and functions before running the program. Also, you did not provide a snippet to illustrate variable hoisting.

Writing

Problem Set 2.5 - Array Fundamentals

Short Response Section

Directions: Write your responses to the questions below directly in this document. When you commit and push your changes, you will be able to see your rendered markdown on GitHub.

1. What does it mean for arrays to be passed by reference in JavaScript? Be sure to include a code snippet to illustrate your response.

Pass By Reference refers to the concept of passing the address (reference) to the array. Therefore, if you make any changes to the array inside the function, these changes are saved in memory to the original array. All variables that reference the array, even outside of the function, will reflect the changes since it's bound to the same array in memory.

Problem Set 2.5 - Array Fundamentals

Short Response Section

Directions: Write your responses to the questions below directly in this document. When you commit and push your changes, you will be able to see your rendered markdown on GitHub.

1. What does it mean for arrays to be passed by reference in JavaScript? Be sure to include a code snippet to illustrate your response.

Answer: Arrays are passed by reference, meaning when an array is initialized, an address of the location of the value of the array that is saved in the heap memory is saved in the variable.

@thuyanduong
thuyanduong / README.md
Last active April 11, 2022 15:57
Unit 7 Project Project Proposal

Project Name

Heading

Name the product in a way the reader (i.e. your target customers) will understand. (3+ sentences)

Sub-Heading

Describe who the market for the product is and what benefit they get. (One sentence only underneath the title)

Summary

> Give a summary of the product and the benefit. What are all the things a user can do when use your product? This is the most important section for your readers, so make this paragraph good. (5+ sentences)