// Option.ts
// definition
export class None {
readonly tag: 'None' = 'None'
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 race = async function * (size, taskIter) { | |
| const queue = [] | |
| // enqueue | |
| while (queue.length < size) { | |
| const nextTask = taskIter.next() | |
| if (!nextTask.done) { | |
| queue.push(nextTask.value()) |
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 utoa(str) { | |
| return window.btoa(unescape(encodeURIComponent(str))) | |
| } | |
| function atou(str) { | |
| return decodeURIComponent(escape(window.atob(str))) | |
| } |
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
| ['contextmenu', 'selectstart', 'copy'].forEach(function(ev){ | |
| document.addEventListener(ev, function(event){ | |
| return event.returnValue = false | |
| }) | |
| }); |
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
| /^(?!.*hello).*$/.test('hello') | |
| /^((?!hello).)*$/.test('hello') |
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 Config = { | |
| title: string | |
| description: string | |
| rules: Rule[] | |
| } | |
| type Rule = { | |
| description: string, | |
| manipulators: Manipulator[] | |
| } |
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
| let channels = [ | |
| {'name': 'ηΊ’εΏε θ΅«', 'channel_id': -3}, | |
| {'name': 'ζηη§δΊΊε θ΅«', 'channel_id': 0}, | |
| {'name': 'ζ―ζ₯η§δΊΊζε', 'channel_id': -2}, | |
| {'name': 'θ±η£η²Ύιε θ΅«', 'channel_id': -10}, | |
| // εΏζ / εΊζ― | |
| {'name': 'ε·₯δ½ε¦δΉ ', 'channel_id': 153}, | |
| {'name': 'ζ·ε€', 'channel_id': 151}, | |
| {'name': 'δΌζ―', 'channel_id': 152}, | |
| {'name': 'δΊ’ε₯', 'channel_id': 154}, |
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 function findIndex <T> (items: T[], fn: (item: T, index: number) => boolean) { | |
| for (let index = 0, len = items.length; index < len; index++) { | |
| if (fn(items[index], index)) return index | |
| } | |
| return -1 | |
| } | |
| export function flatMap <T, U> (items: T[], fn: (item: T, index: number) => U[]) { | |
| return items.reduce((acc, item, index) => acc.concat(fn(item, index)), [] as U[]) |
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
| π Morning 471 commits βββββββββββββββββββββ 24.2% | |
| π Daytime 610 commits βββββββββββββββββββββ 31.4% | |
| π Evening 581 commits βββββββββββββββββββββ 29.9% | |
| π Night 281 commits βββββββββββββββββββββ 14.5% |
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 { useEffect, useRef } from 'react' | |
| export const useClickOutside = <T extends HTMLElement>(callback: (event: MouseEvent) => void) => { | |
| const ref = useRef<T>(null) | |
| const eventRef = useRef(callback) | |
| useEffect( | |
| () => { | |
| eventRef.current = callback |