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 { readFile } from 'fs/promises' | |
| import crypto from 'crypto' | |
| import OAuth from 'oauth-1.0a' | |
| import fetch from 'node-fetch' | |
| import { config } from 'dotenv' | |
| config() | |
| const CAPTION_SEPARATOR = ' - ' | |
| const POST_STATE = 'draft' // creating post as a draft |
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 isInDM ( | |
| subject: TextableChannel, | |
| ): subject is PrivateChannel | |
| export function isInDM ( | |
| subject: Message, | |
| ): subject is Message<PrivateChannel> | |
| export function isInDM ( | |
| subject: Message | TextableChannel, | |
| ): subject is Message<PrivateChannel> | PrivateChannel { | |
| if (subject.constructor === Message) { |
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
| { | |
| "name": "request", | |
| "version": "1.0.0", | |
| "main": "request.js" | |
| } |
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
| /* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-return */ | |
| import { | |
| promises as fs, | |
| } from 'fs' | |
| import { join } from 'path' | |
| export async function load (path: string): Promise<any> | |
| export async function load (path: Array<string>): Promise<Array<any>> | |
| export async function load ( | |
| path: string | Array<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
| function groupBy <T = unknown> ( | |
| list: Array<T>, | |
| keyGen: (item: T) => string | number, | |
| ): {[k: string]: Array<T>} { | |
| return list.reduce<{[k: string]: Array<T>}>((ax, dx) => { | |
| const key = keyGen(dx) | |
| if (ax[key]) { | |
| ax[key].push(dx) | |
| } else { |
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 express, { RequestHandler, Response } from 'express' | |
| import bodyParser from 'body-parser' | |
| import cors from 'cors' | |
| interface Client { | |
| id: string | |
| res: Response | |
| } | |
| interface Item { |
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
| class Project { | |
| private _workItems: WorkItem[] = []; | |
| public get workItems(): WorkItem[] { | |
| return this._workItems; | |
| } | |
| public addWorkItem(item: WorkItem): number { | |
| const id = this._workItems.push(item); | |
| item.id = id; |
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 { EventEmitter } = require('events') | |
| class PriorityJobQueue extends EventEmitter { | |
| constructor (levels, ...rest) { | |
| super(...rest) | |
| this.queues = new Array(levels).fill([]) | |
| this.currentJob = null | |
| this.totalJobs = 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
| import Upload from './Upload.js' | |
| export default class Artist { | |
| constructor (canvas) { | |
| this.canvas = canvas | |
| this.ctx = canvas.getContext('2d') | |
| } | |
| getLink () { | |
| return this.canvas.toDataURL() |
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
| // request('https://www.google.com').then(console.log) | |
| const https = require('https') | |
| const http = require('http') | |
| const { URL } = require('url') | |
| const requesters = { | |
| 'http:': http, | |
| 'https:': https | |
| } |
NewerOlder