Skip to content

Instantly share code, notes, and snippets.

View jt3k's full-sized avatar
🐷
Summer is coming!

Andrey Gurtovoy jt3k

🐷
Summer is coming!
View GitHub Profile
@jt3k
jt3k / s.js
Last active December 10, 2015 01:08
Задачка из вакансий яндыкса
/*
Задача:
function reversePrint(linkedList) {
// ...
}
var someList = {
value: 1,
next: {
@jt3k
jt3k / dabblet.css
Created June 28, 2013 08:53
The first commented line is your dabblet’s title
/**
* 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;}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
html,
body {
height: 100%;
}
/**
* Рекурсивная функция декомпозирующая объект.
* Обязательный только первый аргумент остальные нужны только для работы данной функции: TODO спрятать в arguments
* @param {Object} obj Приходящий в рекурсию объект(либо другое)
*
* @param {String} key Ключ по которому пришли
* @param {String} curPath Путь к ключу в текстовом виде
* @param {Number} deep Глубина рекурсии (глубина пути)
* @param {Object} returnObj Объект в который будет набиваться свойствами(см ниже),
* а также этот объект будет возвращён из данной функции
@jt3k
jt3k / safeMath.js
Last active January 16, 2017 15:58
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;
@jt3k
jt3k / example-attempt.js
Last active November 14, 2017 10:50
promise with attempts
// 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();
@jt3k
jt3k / keybr-com.js
Last active June 29, 2020 15:59
Voice over of the next word at https://www.keybr.com/
// 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