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 snippet adds voice-over to the next word in the event of a spacebar or erroneous press | |
// To sound after an error, you will need to enable "Settings → Miscellaneous → Forgive errors" | |
// How to use ? | |
// 1. Open https://www.keybr.com/ | |
// 2. Press Ctrl+Shift+I (or F12) to open devTools | |
// 3. Paste this code into the console | |
// 4. Close the devTools | |
// 5. Enjoy |
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
// fake fetch-data function | |
function fetch () { | |
const isFailure = Math.random() > .9; | |
console.log(isFailure); | |
return isFailure ? Promise.resolve({data: 'data'}) : Promise.reject(); | |
} | |
// building promise with attempts | |
function getData(attempt = 3) { | |
let p = fetch(); |
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 safeMath(example) { | |
const numbersRegX = /[0-9]+(\.[0-9]+|)?/g; | |
const replaceData = []; | |
example.replace(numbersRegX, function() { | |
replaceData.push(arguments); | |
}); | |
const maxFract = replaceData.reduce((max, [,fract]) => { | |
if (fract && max < fract.length) { | |
max = fract.length; |
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
/** | |
* Рекурсивная функция декомпозирующая объект. | |
* Обязательный только первый аргумент остальные нужны только для работы данной функции: TODO спрятать в arguments | |
* @param {Object} obj Приходящий в рекурсию объект(либо другое) | |
* | |
* @param {String} key Ключ по которому пришли | |
* @param {String} curPath Путь к ключу в текстовом виде | |
* @param {Number} deep Глубина рекурсии (глубина пути) | |
* @param {Object} returnObj Объект в который будет набиваться свойствами(см ниже), | |
* а также этот объект будет возвращён из данной функции |
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> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
html, | |
body { | |
height: 100%; | |
} |
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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
body{ | |
font-size:100px | |
} | |
@keyframes lo { | |
from,to {font-size:1em; left: .5em; top:1.25em} | |
60% {font-size:1em; left: .5em; top:1.25em} | |
70% {font-size:2em; left: 0; top: 0.5em;} |
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 reversePrint(linkedList) { | |
// ... | |
} | |
var someList = { | |
value: 1, | |
next: { |