Deno는 Node.js를 만든 Ryan Dhal의 차세대 자바스크립트/타입스크립트 런타임입니다.
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
declare global { | |
interface PromiseConstructor { | |
resolve<const T>(value: T): Promise<Awaited<T>> | |
} | |
} |
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 { z } from "https://deno.land/x/[email protected]/mod.ts" | |
import { HasType } from "./type_helper.ts" | |
export type AnyZodEffect = z.ZodEffects<z.ZodTypeAny, unknown, unknown> | |
export type ObjectSchema = z.ZodObject<z.ZodRawShape> | |
/** Recursively checks if schema has a transform effect for either the whole object or a property. */ | |
export type HasZodEffect<T> = T extends ObjectSchema | |
? HasType<T["shape"], AnyZodEffect> extends true ? true |
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 { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts" | |
/** @example | |
* const input = [1, 1, -1, 1, -1, 1] | |
* assertEquals(span(input, (x) => x > 0), [[1, 1], [-1, 1, -1, 1]]) | |
*/ | |
export const span = <T>(array: T[], predicate: (line: T) => boolean): [T[], T[]] => { | |
const index = array.findIndex((line) => !predicate(line)) | |
const before = index === -1 ? array : array.slice(0, index) | |
const after = index === -1 ? [] : array.slice(index) |
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 { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts" | |
import { outdent } from "npm:outdent" | |
import { trisection } from "./partition_utils.ts" | |
import { walk } from "https://deno.land/[email protected]/fs/walk.ts" | |
import { asynciter } from "https://deno.land/x/[email protected]/asynciter.ts" | |
import { fromFileUrl, join, resolve } from "https://deno.land/[email protected]/path/mod.ts" | |
export const SCRIPT_DIR = fromFileUrl(import.meta.url) | |
export const TOP_DIR = resolve(SCRIPT_DIR, "..", "..", "..") | |
export const JSON_DIR = join(TOP_DIR, "data") |
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
// ==UserScript== | |
// @name Github local timezone format | |
// @namespace https://github.com/scarf005 | |
// @match https://github.com/* | |
// @match https://gist.github.com/* | |
// @version 1.1.0 | |
// @description Make github use local timezone format | |
// @icon https://github.githubassets.com/pinned-octocat.svg | |
// @grant none | |
// @downloadURL https://gist.githubusercontent.com/scarf005/20a54f241aabebe89ff3d375b1fc59ff/raw/github-local-timezone.user.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
function successes<T>(xs: PromiseSettledResult<T>[]): T[] { | |
return xs | |
.filter((x): x is PromiseFulfilledResult<T> => x.status === "fulfilled") | |
.map((x) => x.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
{ | |
"editor.tabSize": 2, | |
"editor.indentSize": "tabSize", | |
"editor.detectIndentation": false, | |
"editor.formatOnSave": true, | |
"editor.formatOnPaste": true, | |
"[c][cpp]": { | |
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd" | |
}, | |
"[log]": { |
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 PluginName = `${string}/${string}` | |
type Year = `${number}${number}${number}${number}` | |
/** An array of glob patterns indicating the files that the configuration object should apply to. If not specified, the configuration object applies to all files matched by any other configuration object. */ | |
type Files = string[] | |
/** An array of glob patterns indicating the files that the configuration object should not apply to. If not specified, the configuration object applies to all files matched by {@link Files}. */ | |
type Ignores = string[] | |
/** An object containing settings related to how JavaScript is configured for linting. */ |
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 TIME1 = { | |
MILLISECOND: 1, | |
SECOND: 1000, | |
MINUTE: 1000 * 60, | |
HOUR: 1000 * 60 * 60, | |
DAY: 1000 * 60 * 60 * 24, | |
WEEK: 1000 * 60 * 60 * 24 * 7, | |
MONTH: 1000 * 60 * 60 * 24 * 30, | |
YEAR: 1000 * 60 * 60 * 24 * 365, | |
} |