This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function factorial(number) { | |
if (number === 0) { return 1; } | |
return number * factorial(number - 1); | |
} | |
// factorial(0) -> 1 | |
// factorial(1) -> 1 | |
// factorial(2) -> 2 | |
// factorial(3) -> 6 | |
// factorial(4) -> 24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Name and inputs | |
const hacker1 = "Isak"; | |
const hacker2 = prompt("What is the name of the navigator?"); | |
console.log(`The driver's name is ${hacker1}`); | |
console.log(`The navigator's name is ${hacker2}`); | |
// Conditionals | |
if (hacker1.length > hacker2.length) { | |
console.log( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use mongoimport to import a data in JSON format into the database | |
$ mongoimport --db pacman --collection enemies --file pacman.json | |
$ mongoimport --db restaurants --collection restaurants --drop --file ~/downloads/primer-dataset.json | |
// Insert one document in the database | |
$ db.enemies.insertOne({ name: 'pacman' }); | |
// can use javascript in MongoDB | |
$ const t = { name: 'Isak' } | |
$ db.enemies.insertOne(t); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 0; | |
padding: 0; | |
font-family: monospace; | |
} | |
header { | |
display: block; | |
height: 5vh; | |
overflow: auto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove a non empty folder | |
$ rm -rf lampp | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Full documentation: https://docs.npmjs.com/getting-started/ | |
// Listing globally installed NPM packages and version | |
npm list -g --depth=0 | |
// Global packages can be uninstalled with | |
npm uninstall -g <package> | |
ex. npm uninstall -g jshint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title></title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link href="style.css" rel="stylesheet"> | |
</head> | |
<body> | |
<h1 id="unique">Unique ID</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... |