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
| (async () => { | |
| const $ = (s, e = document) => e.querySelector(s); | |
| const $$ = (s, e = document) => e.querySelectorAll(s); | |
| const pause = (ms) => new Promise(r => setTimeout(r, ms)); | |
| let videos = [...$$('#contents ytd-expanded-shelf-contents-renderer').values()]; | |
| if (!videos.length) { | |
| videos = [...$$('#contents.ytd-rich-grid-renderer .ytd-rich-grid-renderer').values()]; | |
| } | |
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
| async handler(argv, {console, describe, options, style}) { | |
| // Print command description | |
| console.important(describe); | |
| // Prompt user for option or use default | |
| const value = await console.cli.require(options.val); | |
| // Print 'value' with style and color | |
| console.log('value:', style.bold.cyan(value), style.gray(argv.val)); | |
| } |
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 {createCommand} from '@mail-core/cli'; | |
| export const test = createCommand({ | |
| name: 'test', | |
| describe: 'Тестовая команда', | |
| options: { | |
| val: { | |
| desc: 'Any value', | |
| type: '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
| export const noop = () => {}; | |
| export const nativeGlobalThis = (0 | |
| || typeof globalThis === 'object' && globalThis | |
| || typeof window === 'object' && window | |
| || typeof global === 'object' && global | |
| || {} | |
| ) as Window; | |
| export const globalLocation = nativeGlobalThis.location || { |
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
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "github.com/gothing/draft" | |
| "github.com/gothing/draft-demo/auth" | |
| ) |
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
| // InitEndpointScheme - инициализация описания «конца» | |
| func (a *AuthLogin) InitEndpointScheme(s *draft.Scheme) { | |
| // Проект, которому принадлежит «конец» | |
| s.Project("auth") | |
| // Метод доступен всем | |
| s.Access(draft.Access.All) | |
| // Базовый метод для всех кейсов | |
| s.Method(draft.Method.POST) |
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
| // AuthLoginResponse — ответ на запрос | |
| type AuthLoginResponse struct { | |
| // инлайн комментарий с наследованием родительского | |
| UserID types.UserID `comment:"{super}, авторизованного пользователя"` | |
| } |
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
| package types | |
| type Login string | |
| func (v Login) TypeDescription() string { | |
| return "Login пользователя (он же email, телефон или соц. аккаунт)" | |
| } | |
| func GenLogin() Login { | |
| return "[email protected]" |
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 Key = string; | |
| type Val = string | number; | |
| type KeyValue< | |
| K extends Key, | |
| P extends Key, // Дополнительные поля (!) | |
| V extends Val, | |
| > = ( | |
| & Record<K, V> | |
| & Record<P, any> | |
| ); |
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 Key = string; | |
| type Val = string | number; | |
| type KeyValue<K extends Key, V extends Val> = { | |
| [X in K]: V; | |
| } | |
| type CompostedObject<KEY extends Key, T extends KeyValue<KEY, Val>[]> = | |
| FlattenObject< | |
| ToIntersect< | |
| { | |
| [K in keyof T]: T[K] extends KeyValue<KEY, Val> |
NewerOlder