Skip to content

Instantly share code, notes, and snippets.

View seonglae's full-sized avatar
:electron:
Knowledge absorbing

Seonglae Cho seonglae

:electron:
Knowledge absorbing
View GitHub Profile
@seonglae
seonglae / index.ts
Last active February 25, 2022 18:11
Generic function with inner class export error
function genericFunction(a: number) {
class InnerClass {
property = a
}
return InnerClass
}
export { genericFunction }
@seonglae
seonglae / renovate.json5
Created February 17, 2022 15:29
renovate.json5
{
extends: ['config:base', 'schedule:weekly', 'group:allNonMajor'],
labels: ['dependencies'],
pin: false,
rangeStrategy: 'bump',
node: false,
packageRules: [{ depTypeList: ['peerDependencies'], enabled: false }],
}
@seonglae
seonglae / karabiner.json
Last active January 30, 2024 05:08
Intuiter for Mac OS with Karabiner
{
"global": {
"ask_for_confirmation_before_quitting": true,
"check_for_updates_on_startup": true,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false,
"unsafe_ui": false
},
"profiles": [
{
@seonglae
seonglae / waitUntil.ts
Created June 25, 2021 16:35
Wait Until Verifiyer Function return true Interval Promise Function
async function waitUntil<T>(
flag: (...args: any[]) => boolean,
callback: (...args: any[]) => T,
args: any[] = [],
time: number = 50
): Promise<T> {
return new Promise(async resolve =>
flag() ? resolve(await callback(...args)) : setTimeout(() => this.waitUntil(flag, callback, args, time), time)
)
}
@seonglae
seonglae / progressPromises.ts
Created June 25, 2021 07:08
Typescript Promise Array CLI Progress Visualizer for General
import * as progress from 'cli-progress'
async function progressPromises<T>(promises: Array<Promise<T>>, title: string): Promise<Array<T>> {
const bar = new progress.Bar({
format: title + ' |' + colors.cyan('{bar}') + '| {percentage}% || {value}/{total} Chunks || Speed: {speed}',
barCompleteChar: '\u2588',
barIncompleteChar: '\u2591',
hideCursor: true,
})
bar.start(promises.length, 0, { speed: 'N/A' })
@seonglae
seonglae / asyncChunkRequest.ts
Last active June 25, 2021 07:09
Typescript Array divided chunk async procedure for General
async function asyncChunkRequest<Input, Output>(
inputs: Array<Input>,
method: (inputs: Array<Input>, ...args: unknown[]) => Array<Output> | Promise<Array<Output>>,
args: unknown[] = [],
chunkSize: number = 100
): Promise<Array<Output>> {
const results: Array<Output> = []
for (const index in Array.from({ length: Math.ceil(inputs.length / chunkSize) })) {
const chunk = inputs.slice(Number(index) * chunkSize, (Number(index) + 1) * chunkSize)
const chunkResult = await method(chunk, ...args)
@seonglae
seonglae / docker-compose.yml
Last active November 28, 2020 07:42
filebrowser https docker compose
version: '3'
services:
drivebrowser:
image: hurlenko/filebrowser
ports:
- 8282:8080
volumes:
- ./Desktop:/data/Desktop
- ./Music:/data/Music
@seonglae
seonglae / gcp_bucket.yml
Last active March 22, 2021 15:17
Github Action GCP Bucket Deploy
name: CI/CD
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
@seonglae
seonglae / node_worker.cc
Last active July 31, 2021 14:12
Universal Node Addon Thread Worker Class which pass function, args
/*
<summary>Beautiful Node Addon Thread Worker</summary>
*/
template <class ReturnType, class... Types> struct ArgsWrapper {
template <class C, Types... args>
class CoreWorker : public Napi::AsyncWorker {
public:
CoreWorker(Napi::Env &env, C *core, function<ReturnType(C &)> func)
: Napi::AsyncWorker(env), deferred(Napi::Promise::Deferred::New(env)),
core(core), func(func) {}
@seonglae
seonglae / webpack.config.js
Last active August 13, 2020 02:06
webpack.config.js Template for small vanilajs project
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const path = require('path')
module.exports = (env, argv) => ({
entry: {
index: './js/index.js'
},
performance: {
hints: false
},