This file contains 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 generateAliasesResolver from 'esm-module-alias'; | |
import { glob } from 'glob'; | |
// TODO Create an aliases map { '@dir/a': 'dist/@dir/a/index.js', '@dir/b': 'dist/@dir/b/index.js', ... } | |
const aliases = glob | |
.sync('dist/@*/*/index.js', { cwd: import.meta.dirname }) | |
.reduce((a, jsfile) => { | |
a[jsfile.substring(13, jsfile.length - 9)] = jsfile; | |
return a; | |
}, {}); |
This file contains 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 cors from '@koa/cors'; | |
import Router from '@koa/router'; | |
import fs from 'fs'; | |
import https from 'https'; | |
import Koa from 'koa'; | |
import { DateTime } from 'luxon'; | |
const app = new Koa(); | |
const router = new Router(); |
This file contains 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
/** | |
* Basic CSS Media Query Template | |
* TODO: I should probably use Sass... | |
* Author: Michael Vieth | |
* ------------------------------------------ | |
* Responsive Grid Media Queries - 1280, 1024, 768, 480 | |
* 1280-1024 - desktop (default grid) | |
* 1024-768 - tablet landscape | |
* 768-480 - tablet | |
* 480-less - phone landscape & smaller |
This file contains 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 { describe, test, expect } from 'vitest'; | |
import TimeMatcher from 'node-cron/src/time-matcher'; | |
describe('node-cron TimeMatcher test', () => { | |
test('should match times', async () => { | |
const seoul = new TimeMatcher('* 9-16 * * 1-5', 'Asia/Seoul'); | |
expect(seoul.match(new Date('2022-09-18T12:38+09:00'))).toBeFalsy(); // is sunday | |
expect(seoul.match(new Date('2022-09-19T12:38+09:00'))).toBeTruthy(); // is monday | |
expect(seoul.match(new Date('2022-09-19T08:59+09:00'))).toBeFalsy(); |
This file contains 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 { ObservableInput, isObservable, Observable } from 'rxjs'; | |
export type OperatorReturn<R> = ObservableInput<R> | R extends ObservableInput< | |
infer U | |
> | |
? U | |
: R; | |
export type Operator<T, R> = (params: T) => OperatorReturn<R>; |
This file contains 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
module.exports = function() { | |
return 'hello world?'; | |
} |
This file contains 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 Koa from 'koa'; | |
import koaBody from 'koa-body'; | |
import Router from 'koa-router'; | |
import { Socket } from 'net'; | |
const port: number = 9903; | |
// --------------------------------------------- | |
// server | |
// --------------------------------------------- |
This file contains 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 fs, { ReadStream, WriteStream } from 'fs-extra'; | |
import Koa from 'koa'; | |
import Body from 'koa-body'; | |
import Router from 'koa-router'; | |
import { Socket } from 'net'; | |
import os from 'os'; | |
import path from 'path'; | |
const port: number = 9903; |
This file contains 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 { createServer, Server } from 'net'; | |
const port: number = 9903; | |
// --------------------------------------------- | |
// server | |
// --------------------------------------------- | |
const form: string = ` | |
<html> | |
<body> |
This file contains 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 { createServer, Server, Socket } from 'net'; | |
const port: number = 9903; | |
// --------------------------------------------- | |
// server | |
// --------------------------------------------- | |
const server: Server = createServer((clientSocket: Socket) => { // 2. this is the client below | |
console.log(`[server] connected client: ${JSON.stringify(clientSocket.address())}`); | |
NewerOlder