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
| /** | |
| * @param curry | |
| * | |
| * @usage | |
| * const _sum3 = (x, y, z) => x + y + z; | |
| * const _sum4 = (p, q, r, s) => p + q + r + s; | |
| * | |
| * const sum3 = curry(_sum3); | |
| * sum3(1)(3)(2); // 6 | |
| * const sum4 = curry(_sum4); |
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
| /** | |
| * | |
| * @param varadocCurry | |
| * | |
| * @usage | |
| * const toSum = varadocCurry((x, y) => x + y, 0); | |
| * const toMul = varadocCurry((x, y) => x * y, 1); | |
| * | |
| * toSum(1)(1, 2)(3, 4)(5, 6, 7)(); // 29 | |
| * toMul(1)(1, 2)(3, 4); // 24 |
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
| npm audit | grep -E "(High | Critical)" -B3 -A10 |
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
| // We no longer need the "use strict" directive since | |
| // all ECMAScript modules implicitly use strict mode. | |
| import * as config from "./config.json"; | |
| app.listen(config.server.nodePort, () => { | |
| console.log(`Listening on port ${config.server.nodePort} ...`); | |
| }); |
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
| -- Remove the history from | |
| rm -rf .git | |
| -- recreate the repos from the current content only | |
| git init | |
| git add . | |
| git commit -m "Initial commit" | |
| -- push to the github remote repos ensuring you overwrite history | |
| git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git |
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
| // - WAIT FOR ME! - I PROMISE. | |
| // resolve NESTED promises waiting for inner promises | |
| function nestedPromisesThatresolveAfter4Seconds() { | |
| return new Promise(resolve => { | |
| setTimeout(() => { | |
| setTimeout(() => { | |
| console.log('setTimeout1') | |
| resolve('Promise resolved'); | |
| }, 4000); | |
| console.log('setTimeout2') |
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
| // 1 | |
| ```javascript | |
| function sum(a) { | |
| return function(b) { | |
| return function(c) { | |
| return a + b + c; | |
| }; | |
| }; | |
| } | |
| ``` |
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 removeUrlParameter(url, param) { | |
| if (typeof URLSearchParams !== 'undefined') { | |
| // modern browsers | |
| var r = new URL(url); | |
| r.searchParams.delete(param); | |
| return r.href; | |
| } else { | |
| // IE version | |
| return url.replace(new RegExp('^([^#]*\?)(([^#]*)&)?' + parameter + '(\=[^&#]*)?(&|#|$)' ), '$1$3$5').replace(/^([^#]*)((\?)&|\?(#|$))/,'$1$3$4') | |
| } |
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
| // | |
| // Merge Sort Implentation (Recursion) | |
| // | |
| function mergeSort (unsortedArray) { | |
| // No need to sort the array if the array only has one element or empty | |
| if (unsortedArray.length <= 1) { | |
| return unsortedArray; | |
| } | |
| // In order to divide the array in half, we need to figure out the middle |
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
| // | |
| // Bubble Sort Implementation | |
| // | |
| function bubbleSort (unsortedArray) { | |
| if (unsortedArray.length <= 1) { | |
| return unsortedArray; | |
| } | |
| for (let i = 0; i < unsortedArray.length; i++) { |