I hereby claim:
- I am eugeneglova on github.
- I am eugeneglova (https://keybase.io/eugeneglova) on keybase.
- I have a public key ASBrec6n1FG-muShEVnao1E0EGvSWfu9feDyDgC38639-Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
document.body.innerHTML = ""; | |
var script = document.createElement("script"); | |
script.src = | |
"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.bundle.min.js"; | |
document.body.appendChild(script); | |
document.body.style.background = "#fff"; | |
var script = document.createElement("script"); | |
script.src = | |
"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.css"; |
var list = [1, 3, 5, 2, 6, 7, 9, 4]; | |
list.sort(); | |
function find(list, acc = 0) { | |
if (list.length < 3 && list[1] - list[0] !== 1) return list[0] + 1; | |
const n = Math.round(list.length / 2); | |
const n1 = acc + n; | |
const realN = list[n - 1]; | |
return find(n1 * (n1 + 1) === realN * (realN + 1) ? list.slice(n - (list.length % 2 === 0 ? 0 : 1)) : list.slice(0, n), n1); | |
} | |
find(list); |
'use strict'; | |
const factorial = n => n < 2 ? 1 : n * factorial(n - 1) | |
// run with --harmony and "use strict" to optimize tail call recursion | |
const factorialOptimizedTailRecursion = (n, acc = 1) => n < 2 ? acc : factorialOptimizedTailRecursion(n - 1, acc * n) | |
const n = 100000000 | |
// console.log(factorial(n)) // RangeError: Maximum call stack size exceeded |
/** | |
* Flattens deeply nested array into simple array | |
* @param {Array} arr - input array of numbers | |
* @param {Array} [acc] - accumulator to store resulting array during recursion calls | |
* @return {Array} | |
*/ | |
const flatten = (arr, acc = []) => { | |
const isArray = Array.isArray(arr); | |
// safe check for input |
set nocompatible | |
" filetype off | |
let $PATH = $PATH . ':' . expand("~/.local/bin") | |
call plug#begin('~/.vim/plugged') | |
Plug 'eshion/vim-sync' | |
Plug 'jlanzarotta/bufexplorer' | |
" Plug 'nathanaelkane/vim-indent-guides' |
// [1,3,8,9,17] -> [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ] | |
// Using recursion | |
var dates = [1,3,8,9,17]; | |
function nextI (i) {return i+1;} | |
function getMissingElements(nextI, element, currentNextElement) { | |
var nextElement = nextI(element); | |
if (nextElement === currentNextElement) { | |
return []; | |
} | |
return [nextElement].concat(getMissingElements(nextI, nextElement, currentNextElement)); |
<?php | |
error_reporting(E_ALL & ~E_WARNING); | |
// cache time in seconds | |
$cache_time = 5 * 60; // 5 mins | |
$time = floor(time() / $cache_time) * $cache_time; | |
// Getting headers sent by the client. | |
$headers = apache_request_headers(); |
function check(s) { | |
var i = 0, l; | |
s = s.replace(/[^\{\}\(\)\[\]]/g, ""); | |
l = s.length; | |
if ( ! l) return true; | |
if (l % 2 !== 0) return false; |
(function() { | |
"use strict"; | |
var loaded_css_urls = []; | |
function getFontById(fonts, id) { | |
var found_font; | |
fonts.some(function(font) { | |
if (font.id === id) { |