download file nvm-setup.zip
This file contains hidden or 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
| String.prototype.repeatAsMany = function(n){ | |
| console.log(this); | |
| var str = ''; | |
| for (let index = 0; index < n; index++) { | |
| str += this.toString(); | |
| } | |
| return str; | |
| } |
This file contains hidden or 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 createTable(params) { | |
| html = ''; | |
| list.forEach(element => { | |
| html += '<tr>'; | |
| html += `<td>${element.firstName}</td>`; | |
| html += `<td>${element.lastName}</td>`; | |
| html += `<td>${element.age}</td>`; | |
| html += '</tr>'; | |
| }); |
This file contains hidden or 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
| https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04 | |
| free -h | |
| sudo fallocate -l 3G /swapfile | |
| sudo chmod 600 /swapfile | |
| sudo mkswap /swapfile | |
| sudo swapon /swapfile | |
| sudo swapon --show | |
| free -h |
This file contains hidden or 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
| // array from 0 to n | |
| // [0,1,3] | |
| use strict | |
| let myArr = [0,1,3]; | |
| function name(myArr) { | |
| let myObj = {}; |
This file contains hidden or 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
| const reverseInt = (num) => { | |
| return num.toString().split('').reverse().join(''); | |
| }; | |
| console.log(reverseInt(415)); // 514 | |
| console.log('be'); |
This file contains hidden or 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 promiseAll(promises) { | |
| const outputs = []; | |
| let settledPromiseCounter = 0; | |
| return new Promise((resolve, reject) => { | |
| promises.forEach((promise, i) => { | |
| promise.then((value)=> { | |
| outputs[i] = value; | |
| settledPromiseCounter++; | |
| if (settledPromiseCounter === promises.length) { | |
| resolve(outputs); |
This file contains hidden or 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 fibo(num) { | |
| let one = 1; | |
| let two = 1; | |
| let temp = 0; | |
| let fiboo = []; | |
| for (let index = 0; index < num; index++) { | |
| temp = one + two; | |
| fiboo.push(temp); |
This file contains hidden or 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 deepEqual(valueOne, valueTwo) { | |
| if (typeof valueOne !== 'object' && typeof valueTwo !== 'object') { | |
| const isValueOneNaN = isNaN(valueOne) && typeof valueOne === 'number'; | |
| const isValueTwoNan = isNaN(valueTwo) && typeof valueTwo === 'number'; | |
| if (isValueOneNaN && isValueTwoNan) return true; | |
| return valueOne === valueTwo; | |
| } |
This file contains hidden or 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> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <style style="display: block;white-space: pre;" contenteditable=""> |
NewerOlder