Skip to content

Instantly share code, notes, and snippets.

@zakuroishikuro
Last active November 19, 2022 15:44
Show Gist options
  • Save zakuroishikuro/55b9d17a9e58abfa9bc3fa0477c281ad to your computer and use it in GitHub Desktop.
Save zakuroishikuro/55b9d17a9e58abfa9bc3fa0477c281ad to your computer and use it in GitHub Desktop.
declare global {interface Object { log<T>(this: T, msg?): T }} // prettier-ignore
export function main(input: string): number | string {
const [A, B] = input.split(/\s/).map(Number);
return input;
}
// === ここから読む必要なし ===
const DEBUG = process.env.NODE_ENV === "test";
Object.assign(Object.prototype,{log<T>(this:T,msg="log"){if(DEBUG)console.log(`[${msg}] ${this}`);return this}}) // prettier-ignore
if (!DEBUG) {
if (process.send) console.log(main(require("fs").readFileSync(0, "utf8").trim()));
else require("child_process").fork(__filename, { execArgv: ["--stack-size=99900"] });
}
{
"configurations": [
{
"name": "Launch TypeScript Using ts-node",
"type": "node",
"request": "launch",
"env": { "NODE_ENV": "test" },
"skipFiles": ["<node_internals>/**", "node_modules/**"],
"runtimeArgs": ["--stack-size=99900", "--nolazy", "-r", "ts-node/register"],
"program": "${file}"
}
]
}
@zakuroishikuro
Copy link
Author

もうすでにけっこう変わってます。まとめなおす気は・・・・・

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment