Skip to content

Instantly share code, notes, and snippets.

View hochan222's full-sized avatar
😀
Developer

hochan Lee hochan222

😀
Developer
View GitHub Profile
@hochan222
hochan222 / replace_macro.js
Last active March 4, 2023 11:44
replace /{{bug\((\d+)\)}}/g to [Firefox bug $1](https://bugzil.la/$1)
const fs = require('fs');
const path = require('path');
const pattern = /{{\s*[bB]ug\("?(\d+)"?\)\s*}}/g;
const replacement = '[Firefox bug $1](https://bugzil.la/$1)';
function processFile(file) {
fs.readFile(file, 'utf8', (err, data) => {
if (err) {
console.error(err);
@hochan222
hochan222 / replace-macro.js
Created January 21, 2023 09:14
replace macro to tag
// {{ARIARole("button")}} => <a href='/ko/docs/Web/Accessibility/ARIA/Roles/button_role'><code>button</code></a>
const fs = require("fs");
const path = require("path");
const replaceInFile = (file) => {
const data = fs.readFileSync(file, "utf8");
const result = data.replace(/\{\{\s*ARIARole\s*\(\s*['"]([^'"]+)['"]\s*\)\s*\}\}/g, "<a href='/ko/docs/Web/Accessibility/ARIA/Roles/$1_role'><code>$1</code></a>");
fs.writeFileSync(file, result, "utf8");
}
@hochan222
hochan222 / checkType.js
Created January 18, 2022 04:35
javascript checkType
function checkType(variable) {
return Object.prototype.toString.call(variable).slice(8,-1);
}
@hochan222
hochan222 / .zshrc
Last active October 11, 2021 09:39
zshrc setting
export GPG_TTY=$(tty)
alias holee='git config --unset user.name&&git config --unset user.email&&git config user.name "hochan222"&&git config user.email "hochan049@gmail.com"&&git config --list'
@hochan222
hochan222 / padstart.ts
Created August 22, 2021 09:22
padstart
const padStart = (targetLength: number, padString: string, str: string): string => {
return str.length >= targetLength ? str : new Array(targetLength - str.length + 1).join(padString) + str;
};
@hochan222
hochan222 / contextMenu.jsx
Created July 7, 2021 04:24
마우스 우클릭 동작 (React)
<div
onContextMenu={
(e) => {
e.preventDefault();
console.log('no menu');
}
}>
</div>
// event 발생시 preventDefault를 통해 기본적인 브라우저 동작에 의한 메뉴 생성을 중단할 수 있다.
@hochan222
hochan222 / hidden-remove.py
Last active June 13, 2021 15:33
MDN remove hidden compatibility regex
from pathlib import Path
import re
fixes = []
class Stop(Exception):
"""exit early"""
@hochan222
hochan222 / gpg.md
Last active May 6, 2021 15:56
Setting gpg
@hochan222
hochan222 / .env
Created May 6, 2021 13:41
.env for translated-content
CONTENT_TRANSLATED_ROOT=/Users/tonybyeon/Desktop/translated-content/files
EDITOR=code
@hochan222
hochan222 / leak_check.sh
Last active April 26, 2021 14:05
leak check
while 1 ; do leaks [ps] ; sleep 3 ; clear ; done