Skip to content

Instantly share code, notes, and snippets.

@1travelintexan
1travelintexan / cloudinary-setup.md
Created October 26, 2023 09:27
Cloudinary React (module-3)

1. Cloudinary account setup

Go to this link https://cloudinary.com/ and create your cloudinary account, verify your email and go through or skip the initial questions

After you are done you should be able to see the following in your dashboard:

  • Cloud Name
  • API key
  • API Secret
function filter_list(l) {
return l.filter((elem)=> typeof elem === 'number')
}
class Chronometer {
constructor() {
this.currentTime = 0;
this.intervalId = null;
}
start(printTimeCallback) {
this.intervalId = setInterval(() => {
this.currentTime += 1;
if (printTimeCallback) {
// Iteration 1: All directors? - Get the array of all directors.
// _Bonus_: It seems some of the directors had directed multiple movies so they will pop up multiple times in the array of directors.
// How could you "clean" a bit this array and make it unified (without duplicates)?
function getAllDirectors(moviesArray) {
const directorsArr = moviesArray.map((oneMovie) => {
return oneMovie.director;
});
return directorsArr;
}
// Soldier
class Soldier {
constructor(health, strength) {
this.health = health;
this.strength = strength;
}
attack() {
return this.strength;
}
receiveDamage(damage) {
// Iteration #1: Find the maximum
function maxOfTwoNumbers(num1, num2) {
console.log("here is my log", num1, num2);
if (num1 > num2) {
return num1;
} else {
return num2;
}
}
//iteration 1
const hacker1 = 'Eric'
console.log('The drivers name is '+ hacker1)
const hacker2 = 'Eric'
console.log("The navigator's name is " + hacker2)
//iteration 2
// '' or " " or ` `
if(hacker1.length > hacker2.length){
console.log(`The driver has the longest name, it has ${hacker1.length} characters.`)
@1travelintexan
1travelintexan / coolLinks.js
Created August 11, 2023 15:44
Cool stuff to share and learn
// ℹ️ Gets access to environment variables/settings
// https://www.npmjs.com/package/dotenv
require('dotenv').config()
// ℹ️ Connects to the database
require('./db')
// Handles http requests (express is node js framework)
// https://www.npmjs.com/package/express
const express = require('express')