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
function calculateLeaderboardPlaces(users, minScores) { | |
const sortedUsers = users.toSorted((a, b) => b.score - a.score); | |
const sortedMinScores = Object.values(minScores).sort((a, b) => b - a); | |
const result = []; | |
const isPlaceOccupied = {}; | |
let nextPlace = sortedMinScores.length + 1; | |
// Метка может быть заменена дополнительной переменной, обновляемой внутри вложенного цикла | |
// либо вынесением вложенного цикла в отельную функцию с возвращаемым результатом. | |
iterateUsers: for (const user of sortedUsers) { |
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
/** | |
* ТРЕБОВАНИЕ: | |
* | |
* Необходимо реализовать функцию calculateLeaderboardPlaces. | |
* Функция распределяет места пользователей, учитывая ограничения для получения первых мест и набранные пользователями очки. | |
* Подробное ТЗ смотреть в readme.md | |
* Файл preview.png носит иллюстративный характер, не нужно релизовывать UI! | |
* Реализованную функцию прислать в виде js файла | |
*/ |
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 { Mutable } from '../../types'; | |
import { isObject } from '../assert'; | |
export enum TimeUnit { | |
MilliSecond, | |
Second, | |
Minute, | |
Hour, | |
Day, | |
Week, |
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
export const sampleInput = { | |
tag: 'document', | |
content: [ | |
{ | |
tag: 'heading', | |
content: ['Header'], | |
}, | |
{ | |
tag: 'paragraph', | |
content: [ |
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
Задача | |
Написать реакт хук который позволяет получать данные. Для получения данных есть 2 асинхронные функции: fetchDB для получения данных с сервера и fetchCache для получения данных из кеша. Данные из кеша могут быть не совсем актуальными. Данные из сервера актуальные. Когда хук вызван, следует одновременно начать выполнять запросы на сервер и в кеш. Если данные из кеша приходят первыми - следует вернуть их из хука и продолжать выполнять запрос на сервер. Когда запрос с данными сервера выполнится, обновить возвращаемое значение хука, т.к. данные с сервера более актуальные. В случае если запрос с сервера завершится до завершения запроса из кеша, хук должен вернуть серверные данные. При этом данные из кеша не должны перезаписывать данные с сервера. |
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 React, { useEffect, useState } from 'react'; | |
import { format } from 'date-fns'; | |
import './App.css'; | |
type Subcontractor = { | |
createdAt: number; | |
email: string; | |
name: string; | |
id: string; |
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
type LazyRange = { | |
[Symbol.iterator]: () => Iterator<number> | |
multiply: (factor: number) => LazyRange | |
shift: (amount: number) => LazyRange | |
} | |
function range(start: number, end = Infinity, step = 1): LazyRange { | |
return { | |
[Symbol.iterator]: function* () { | |
let current = start |
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
[{"l":"268","r":"495","t":"46","b":"57"},{"l":"71","r":"114","t":"14","b":"41"},{"l":"78","r":"134","t":"33","b":"63"},{"l":"67","r":"677","t":"90","b":"104"},{"l":"132","r":"696","t":"105","b":"119"},{"l":"131","r":"694","t":"121","b":"134"},{"l":"77","r":"669","t":"179","b":"196"},{"l":"203","r":"688","t":"208","b":"212"},{"l":"131","r":"668","t":"214","b":"228"},{"l":"102","r":"104","t":"135","b":"140"},{"l":"105","r":"115","t":"141","b":"180"},{"l":"77","r":"677","t":"260","b":"274"},{"l":"688","r":"722","t":"329","b":"337"},{"l":"692","r":"724","t":"337","b":"343"},{"l":"131","r":"576","t":"290","b":"304"},{"l":"77","r":"691","t":"335","b":"355"},{"l":"131","r":"640","t":"367","b":"380"},{"l":"76","r":"736","t":"413","b":"427"},{"l":"132","r":"738","t":"439","b":"463"},{"l":"712","r":"727","t":"463","b":"471"},{"l":"76","r":"677","t":"489","b":"503"},{"l":"132","r":"732","t":"513","b":"534"},{"l":"76","r":"667","t":"566","b":"580"},{"l":"131","r":"676","t":"597","b":"611"},{"l":"734","r":"747","t":"593", |
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
[{"l":"268","t":"47","b":"57","r":"276"},{"l":"278","t":"47","b":"57","r":"284"},{"l":"287","t":"47","b":"56","r":"294"},{"l":"296","t":"47","b":"57","r":"303"},{"l":"305","t":"47","b":"57","r":"312"},{"l":"313","t":"47","b":"56","r":"321"},{"l":"323","t":"47","b":"56","r":"331"},{"l":"332","t":"47","b":"56","r":"340"},{"l":"341","t":"47","b":"56","r":"349"},{"l":"350","t":"47","b":"56","r":"358"},{"l":"359","t":"47","b":"56","r":"366"},{"l":"368","t":"47","b":"56","r":"376"},{"l":"377","t":"47","b":"56","r":"385"},{"l":"386","t":"46","b":"56","r":"394"},{"l":"395","t":"46","b":"56","r":"403"},{"l":"404","t":"46","b":"57","r":"413"},{"l":"414","t":"46","b":"57","r":"421"},{"l":"423","t":"46","b":"56","r":"430"},{"l":"433","t":"46","b":"56","r":"440"},{"l":"442","t":"46","b":"56","r":"449"},{"l":"451","t":"46","b":"56","r":"458"},{"l":"461","t":"46","b":"56","r":"466"},{"l":"469","t":"46","b":"56","r":"477"},{"l":"478","t":"46","b":"55","r":"485"},{"l":"487","t":"46","b":"56","r":"495"},{"l":"71","t":"14","b": |
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
module.exports = { | |
config: { | |
// default font size in pixels for all tabs | |
fontSize: 14, | |
// font family with optional fallbacks | |
fontFamily: '"Meslo LG L DZ for Powerline", Monaco, Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace', | |
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) | |
cursorColor: 'rgba(248,28,229,0.8)', |
NewerOlder