Skip to content

Instantly share code, notes, and snippets.

View kolyuchii's full-sized avatar
🎯
Focusing

kolyuchii kolyuchii

🎯
Focusing
View GitHub Profile
@kolyuchii
kolyuchii / index.js
Created March 2, 2020 19:17
Business Open Hours Ratio
function openHoursRatio(queryTimeRange, openHours) {
let duration = 0;
for (let i = 0; i < openHours.length; i += 1) {
const openHour = openHours[i];
duration += Math.min(queryTimeRange.end, openHour.end) - Math.max(queryTimeRange.start, openHour.start);
}
if (duration < 0) {
return 0;
}
return duration / (queryTimeRange.end - queryTimeRange.start);
var reverse = function(x) {
let num = Math.abs(x);
let result = 0;
while(num > 0) {
const lastNum = num % 10;
num = Math.floor(num /= 10);
const temp = result * 10 + lastNum;
result = temp;
}
function find(arr, k) {
const obj = {};
let start = 0;
let finish = 0;
let beg = 0;
let end = 0;
for (let i = 0; i < arr.length; i += 1) {
const item = beg = end = arr[i];
if (item in obj) {
function find(arr) {
const maxDepth = arr.length - 1;
const result = [];
function helper(newArray, arrayIndex) {
for (let i = 0; i < arr[arrayIndex].length; i += 1) {
const arrCopy = newArray.slice(0);
arrCopy.push(arr[arrayIndex][i]);
if (arrayIndex === maxDepth) {
result.push(arrCopy);
} else {
function find(arr) {
const hStack = [];
const pStack = [];
let maxSize = -Infinity;
let pos;
let tempPos;
function helper() {
const tempHeight = hStack.pop();
tempPos = pStack.pop();
define([
'Controllers/PageController',
'Models/Verification'
], function (
PageController,
VerificationModel
) {
const Verify = PageController.extend({
controllerType: PageController.TYPES.TRANSITION,
@kolyuchii
kolyuchii / say300.js
Last active February 25, 2016 14:17
function say300 () {
var a = ['авантюриста','артиллериста','афериста','бандуриста','барьериста','беллетриста',
'буериста','бульдозериста','волюнтариста','гитариста','грейдериста','декабриста',
'домриста','жанриста','интуриста','кавалериста','каламбуриста','(под)канцеляриста',
'карикатуриста','карьериста','колориста','контроллериста','лейбориста','литавриста',
'мануфактуриста','маньериста','мемуариста','гидрометриста','радиометриста',
'секундометриста','тензометриста','фотометриста','хронометриста','(анти)милитариста',
'миниатюриста','монтекристо','(электро)моториста','мрамориста','октябриста','панегириста',
'планериста','пленэриста','прожекториста','прокуриста','пуриста','рапириста','ригориста',
'семинариста','скрепериста','скутериста','(кино)сценариста','террориста','тракториста',
@kolyuchii
kolyuchii / helper
Created October 1, 2014 11:45
Helper for game.ioxapp.com/color/
var f = function () {
var box = document.querySelector('#box');
var cubes = box.querySelectorAll('span');
var el = null;
for(var i = 0, l = cubes.length; i < l; i += 1) {
if (el === null) {
el = cubes[i];
} else if (convert(el.style.backgroundColor) < convert(cubes[i].style.backgroundColor)) {
c(cubes[i]);