Skip to content

Instantly share code, notes, and snippets.

View gloriaJun's full-sized avatar
🍀
The time is never come back.

gloria gloriaJun

🍀
The time is never come back.
View GitHub Profile
@gloriaJun
gloriaJun / getCallerName.js
Last active November 23, 2022 06:47
logger
function getCallerName(error) {
return error.stack?.split('\n')?.[2].trim().split(' ')[1];
}
function Logger() {
const caller = getCallerName(new Error());
console.log('caller : ', caller);
}
function FuncA() {
@gloriaJun
gloriaJun / what-forces-layout.md
Created October 25, 2022 07:02 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@gloriaJun
gloriaJun / clear_master_slave
Last active July 2, 2021 03:22
Jenkins pipeline
#!/usr/bin/env groovy
void clean_dirs(String agentHome) {
targetDir = "${agentHome}/workspace"
days = 3
checkDiskUsageCommand = "du -sh ${targetDir}"
findCommand = "find ${targetDir} -maxdepth 1 -type d -ctime +${days}"
sh """#!/bin/bash
@gloriaJun
gloriaJun / .commitlintrc.js
Last active July 1, 2021 00:47
react-typescript
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'build',
'ci',
'chore',
@gloriaJun
gloriaJun / default.conf
Last active August 3, 2021 09:18
[wip] docker-compose for nginx
server {
listen 80;
server_name localhost;
location / {
root /var/www/storybook/master;
index index.html;
}
}
@gloriaJun
gloriaJun / docker-compose-jenkins.yml
Last active July 2, 2021 06:53
docker-compose for jenkins
version: '3.7'
services:
jenkins:
image: jenkins/jenkins:lts
container_name: jenkins
privileged: true
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@gloriaJun
gloriaJun / conn_svr.exp
Created April 19, 2021 07:37
script for auto-connect to the server
#!/usr/bin/expect -f
#set timeout -1
#set password
set username [lindex $argv 0]
set hostname [lindex $argv 1]
set options [lrange $argv 2 end]
spawn ssh ${username}@${hostname} -o StrictHostKeyChecking=no ${options}
@gloriaJun
gloriaJun / groupBy.ts
Created September 14, 2019 14:15
groupBy.ts
function groupBy<T extends any, K extends keyof T>(array: T[], key: K | { (obj: T): string }): Record<string, T[]> {
const keyFn = key instanceof Function ? key : (obj: T) => obj[key]
return array.reduce(
(objectsByKeyValue, obj) => {
const value = keyFn(obj)
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj)
return objectsByKeyValue
},
{} as Record<string, T[]>
)
@gloriaJun
gloriaJun / imageDownload.js
Created June 25, 2019 14:01
Image Process with javascript
const saveImage = (image, name) => {
const dataURL = image.src
const link = document.createElement("a")
link.download = name
link.href = dataURL
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
@gloriaJun
gloriaJun / app.js
Last active July 17, 2017 05:16
nodejs-webapp-step2
var express = require('express');
// request body에 담긴 값을 읽기 위한 모듈
var bodyParser = require('body-parser');
// 파일을 읽고 쓰기 위한 모듈
var fs = require('fs');
// 파일 업로드 모듈
var multer = require('multer');
// mysql
var mysql = require('mysql');