Skip to content

Instantly share code, notes, and snippets.

View alexcupertme's full-sized avatar
🏠
Working from home

alexcupertme

🏠
Working from home
View GitHub Profile
import chalk from 'chalk';
import { CronJob } from 'cron';
import 'dotenv/config';
import got from 'got';
import { parseDomain, ParseResultType } from 'parse-domain';
type TParsedDomain = {
type: 'LISTED';
hostname: string;
labels: string[];
@alexcupertme
alexcupertme / task.ts
Last active September 11, 2022 20:59
// Better code readability ( O(n), maybe some V8 optimizations can decrease to logn )
export const getScore = (gameStamps: Stamp[], offset: number) => {
const scoreStampIndex = gameStamps.findIndex((stamp) => stamp.offset >= offset);
const scoreStamp = gameStamps[scoreStampIndex];
return scoreStamp && scoreStamp.offset == offset ? scoreStamp : gameStamps[scoreStampIndex - 1];
};
// Better performance ( O(logn) )
export const getScoreThroughBinarySearch = (gameStamps: Stamp[], offset: number) => {
let left = 0;

2022.07.05 14:37 Tags: #work #study #quest


Проектируем сайт-brief-визитку

Краткое описание

Сайт, где пользователь сможет

  1. Посмотреть примеры работ
  2. Заказать проект
    1. Конструктор проекта + калькулятор (пошаговый) - по очереди высвечиваются страницы, которые пользователь может включить к себе в проект (aka платежный автомат Макдоналдс)
  3. Указать сроки проекта
const csvFile = `Title; Author; Annotation
Don Quixote; Miguel de Cervantes; Alonso Quixano, a retired country gentleman in his fifties
Crime and Punishment; Fyodor Dostoyevsky; It is a murder story, told from a murders point of view
The Odyssey; Homer; The Odyssey is one of two major ancient Greek epic poems attributed to Homer
The Brothers Karamazov; Fyodor Dostoyevsky; Dostoevsky's last and greatest novel, The Karamazov Brothers`
const accumulator = [];
const jsonRaw = csvFile.split("\n").slice(1).map((book) => {
const metadata = book.split("; ");
return {
title: metadata[0],
export function isEvenByTask(num: number): boolean {
return Boolean(num % 2);
}
// Rewritten function
export function correctIsEvenFunc(num: number): boolean {
return Boolean(num % 2 == 0);
}
// Test function