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
| // entities/video/index.ts | |
| type IVideo = { | |
| src: string; | |
| } | |
| const getVideoSrc = (video: IVideo): number => { | |
| return video.src; | |
| } | |
| const setVideoSrc = (video: IVideo, src: string): number => { |
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
| const state = [{ | |
| id: 1, | |
| active: false, | |
| loaded: false, | |
| }, { | |
| id: 2, | |
| active: false, | |
| loaded: false, | |
| }, { | |
| id: 3, |
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 * 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; |
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 { 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, |
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
| enum ServicesNames { | |
| WorldService = 'WorldService', | |
| Window = 'WindowService', | |
| DateService = 'DateService', | |
| } | |
| type IServicesList = { | |
| [ServicesNames.WorldService]?: WorldService; | |
| [ServicesNames.Window]?: WindowService; | |
| [ServicesNames.DateService]?: DateService; |
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 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 { |
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
| const fields = [{ | |
| type: 'input', | |
| placeholder: 'My field №1', | |
| value: '', | |
| onChange: (event) => {}, | |
| }, ...]; // 100 разных полей ввода | |
| const GenerateForm = (props) => ( | |
| <Form onSubmit={props.onSubmit}> | |
| {props.fields.map((field) => ( |
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
| 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(); |
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
| const assert = require('assert'); | |
| /** | |
| * @param {Array<Array<number, number>>} guests | |
| * @returns number | |
| */ | |
| function maxGuests(guests) { | |
| let maxCount = 0; | |
| let currentCount = 0; |
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
| const assert = require('assert'); | |
| /** | |
| * @param {Array<string>} anagrams | |
| * @returns Array<Array<string>> | |
| */ | |
| function groupAnagrams(anagrams) { | |
| const groups = new Map(); | |
| for (const word of anagrams) { |