Skip to content

Instantly share code, notes, and snippets.

View josecarneiro's full-sized avatar

José Carneiro josecarneiro

View GitHub Profile
[
{
"name": "Herschel Little America Backpack",
"image": "https://herschel.eu/content/dam/herschel/products/10014/10014-00001-OS_01.jpg.sthumbnails.1000.1250.jpg",
"colors": 53,
"unitsLeft": 15,
"price": {
"value": 10999,
"currency": "EUR"
}
// Iteration #1: Find the maximum
function maxOfTwoNumbers(a, b) {
if (a > b) return a;
return b;
}
// Iteration #2: Find longest word
const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];
/* eslint no-restricted-globals: 'off' */
// Iteration 1: Ordering by year - Order by year, ascending (in growing order)
const orderByYear = array => {
const sortedMovies = [...array];
// const sortedMovies = array.slice();
sortedMovies.sort((firstMovie, secondMovie) => {
const firstMovieYearOfRelease = firstMovie.year;
const secondMovieYearOfRelease = secondMovie.year;
const $cart = document.querySelector('#cart tbody');
const $calc = document.getElementById('calc');
function updateSubtot($product) {
// Iteration 1.1
const $priceSpan = $product.querySelector('.pu span');
const priceValue = $priceSpan.innerText;
const $quantityInput = $product.querySelector('input');
const quantityValue = $quantityInput.value;

Installing and setting up MongoDB

Download it from the official download page.

When asked if you want a "Complete" or a "Custom" installation, select "Custom". Don't change any installation default option, but uncheck the box that says "Run as a service". That would mean MongoDB is always turned on, even while you're not using it.

When asked if you want to install MongoDB Compass, accept it.

Instructions per operating system

SQL Database

Data is stored in tables. Every entry corresponds to a row.

SQL databases are usually relational.

Table: books

title author release_year rating pages
  • /: Home page, displays a list of recent/upvoted posts.
  • /channel/create: Create new channel.
  • /channel/:channel: View for each channel, with channel name, and list of posts.
  • /channel/:channel/post/create: View for each channel, with channel name, and list of posts.
  • /channel/:channel/post/:post: View single post.
  • /user/:username: View single user with posts.
  • /authentication/sign-in: Login.
  • /authentication/sign-up: Sign Up

We can create a post list partial, post item partial, post, navbar partial. The navbar should include a link to the home and a link to the user profile.

class Hangman {
constructor(words) {
this.words = words;
this.letters = [];
this.guessedLetters = '';
this.errorsLeft = 10;
this.secretWord = this.pickWord();
}
pickWord() {

Materials

Presentation

Feel free to use this presentation as a reference.

Starting Code

Open this CodeSandbox and start editing. It will automatically create a fork (that is, a duplicate) for you to work on.

// Iteration #1: Find the maximum
function maxOfTwoNumbers(a, b) {
if (a > b) return a;
return b;
}
// Iteration #2: Find longest word
const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];