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
| /* VT100 terminal reset (<ESC>c) */ | |
| console.log('\033c'); | |
| /* numbers comparations */ | |
| > '2' == 2 | |
| true | |
| > '2' === 2 |
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 genSolution = (number) => { | |
| const string = number.toString(); | |
| let result = ''; | |
| for (let i = string.length; i > 0; i -= 3) { | |
| result = ((i - 3 > 0) ? ',' : '') + string.slice(i - 3 >= 0 ? i - 3 : 0, i) + result; | |
| } | |
| return result; | |
| } |
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
| /* | |
| * A speed-improved perlin and simplex noise algorithms for 2D. | |
| * | |
| * Based on example code by Stefan Gustavson ([email protected]). | |
| * Optimisations by Peter Eastman ([email protected]). | |
| * Better rank ordering method by Stefan Gustavson in 2012. | |
| * Converted to Javascript by Joseph Gentle. | |
| * | |
| * Version 2012-03-09 | |
| * |
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 getFreq = (pos, divider, offset) => pos > divider - offset | |
| ? pos < divider + offset ? divider - offset : divider + offset - (pos - (divider - offset)) | |
| : pos |
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 fetch = require('node-fetch'); | |
| const fireAdmin = require('firebase-admin'); | |
| fireAdmin.initializeApp({ | |
| credential: fireAdmin.credential.applicationDefault() | |
| }); | |
| const getCountries = () => | |
| new Promise((resolve, reject) => { | |
| fetch('https://restcountries.eu/rest/v2/all') |
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
| [email protected] | |
| [email protected] | |
| [email protected] | |
| [email protected] | |
| [email protected] | |
| [email protected] | |
| [email protected] | |
| [email protected] | |
| [email protected] | |
| [email protected] |
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 run = (fn, ...args) => { | |
| return new Worker(URL.createObjectURL(new Blob([`(${fn})(${args})`]))); | |
| } |
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
| import lock from 'pointer-lock'; | |
| const movement = {}; | |
| const USER_SPEED = 0.15; | |
| const handleMove = (initial, camera, move) => { | |
| initial.x += move.dx / 3; | |
| if (initial.y + move.dy < 90 && initial.y + move.dy > -90) { |
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
| /** | |
| * Convert map object to multidimensional array | |
| * @param {Object} object map object | |
| * @return {Array} map array | |
| */ | |
| const mapObjectToArray = object => | |
| Object.keys(object).map((key) => { | |
| if (typeof object[key] === 'object') { | |
| return mapObjectToArray(object[key]); | |
| } else if (typeof object[key] === 'number') { |