Skip to content

Instantly share code, notes, and snippets.

// entities/video/index.ts
type IVideo = {
src: string;
}
const getVideoSrc = (video: IVideo): number => {
return video.src;
}
const setVideoSrc = (video: IVideo, src: string): number => {
const state = [{
id: 1,
active: false,
loaded: false,
}, {
id: 2,
active: false,
loaded: false,
}, {
id: 3,
import * as React from 'react';
const HeaderBar: any = () => null;
const BreadCrumbs: any = () => null;
const PageSection: any = () => null;
const MainContent: any = () => null;
const TopInfo: any = () => null;
const AgeBadge: any = () => null;
const Title: any = () => null;
const Parameters: any = () => null;
import { IContent } from '../../common/mapi/entities/content/Content.h';
import { IPurchaseOptions } from '../../common/mapi/entities/billing/purchaseOptions/PurchaseOptions.h';
import { IVideoWatchTime } from '../../common/mapi/entities/content/WatchTime.h';
import {
getObjectMinPurchaseOption,
getObjectPurchases,
getPurchaseFinishTime,
getPurchaseOptionCurrencySymbol,
getPurchaseOptionDiscountDescription,
getPurchaseOptionPrice,
enum ServicesNames {
WorldService = 'WorldService',
Window = 'WindowService',
DateService = 'DateService',
}
type IServicesList = {
[ServicesNames.WorldService]?: WorldService;
[ServicesNames.Window]?: WindowService;
[ServicesNames.DateService]?: DateService;
type BaseEventsMap = {
[key: string]: any[]; // ключ - название события, значение - возможные аргументы
};
type Callback<P extends any[]> = (...payload: P) => void;
class EventEmitter<EventsMap extends BaseEventsMap> {
events: Map<keyof EventsMap, Set<Callback<EventsMap[keyof EventsMap]>>> = new Map();
on<E extends keyof EventsMap>(event: E, callback: Callback<EventsMap[E]>): Function {
const fields = [{
type: 'input',
placeholder: 'My field №1',
value: '',
onChange: (event) => {},
}, ...]; // 100 разных полей ввода
const GenerateForm = (props) => (
<Form onSubmit={props.onSubmit}>
{props.fields.map((field) => (
const WebSocket = require('ws');
const fs = require('fs');
const path = require('path');
const http = require('http');
const redis = require('redis');
const redisList = redis.createClient();
const redisSub = redis.createClient();
const redisPub = redis.createClient();
@SuperOleg39
SuperOleg39 / ya.js
Last active January 17, 2020 15:29
const assert = require('assert');
/**
* @param {Array<Array<number, number>>} guests
* @returns number
*/
function maxGuests(guests) {
let maxCount = 0;
let currentCount = 0;
const assert = require('assert');
/**
* @param {Array<string>} anagrams
* @returns Array<Array<string>>
*/
function groupAnagrams(anagrams) {
const groups = new Map();
for (const word of anagrams) {