Skip to content

Instantly share code, notes, and snippets.

View mu-hun's full-sized avatar

Kim Mu-hun mu-hun

View GitHub Profile
@mu-hun
mu-hun / README.md
Last active October 24, 2025 04:39
인접한 테스트 유닛에만 훅 실행하기

테스트 수도 코드

describe('root', function () {
  beforeEach(() => {
    console.log('론처 시작')
    startApp()
  })
  afterEach(() => {
    console.log('론처 종료')
@mu-hun
mu-hun / daum-mail.js
Last active August 15, 2020 07:27
북마크 한 메일만 제외해서 삭제하기
const bookmark = '.btn_important.on'
const interval = setInterval(function () {
const items = document.querySelectorAll('.mail_item')
for (const item of items) {
if (item.querySelector(bookmark) == null) item.querySelector('#mCk').click()
}
document.querySelector('.btn_del').click()
if (
document.querySelector('.info_none') != null ||
const fetchMachine = Machine({
initial: 'idle',
states: {
idle: {
on: {
SUBMIT: 'submit',
},
},
submit: {
on: {
@mu-hun
mu-hun / fibonacciLoop.js
Last active May 21, 2020 13:20
Implement fibonacci with Bottom-Up Style
function fib(n) {
let first = 1, second = 0;
let current;
for (let i = 2; i <= n; i++) {
current = first + second
second = first
first = current
}
return current
}
function nextPermutation(A: number[]) {
let i = A.length - 1
let j = A.length - 1
while (i > 0 && A[i - 1] >= A[i]) i -= 1
if (i === 0) return false
while (A[j] <= A[i - 1]) j -= 1
@mu-hun
mu-hun / string_number.ts
Created May 14, 2020 03:15
string to number or number to string
function strToint(string: string) {
let i = 0;
let num = 0;
let isNeg = false;
const length = string.length;
const zeroCode = '0'.charCodeAt(0);
if (string[0] === '-') {
isNeg = true;
i = 1;
const isEqual = <T extends number | string>(first: T[], second: T[]) =>
first.length === second.length &&
first.findIndex((item, index) => item !== second[index]) === -1;
const isEqualVariableArray = <T>(...arrays: T[][]) => arrays.slice(0, arrays.length - 1).findIndex((array, index) => !isEqual<T>(array, arrays[index+1]))
console.assert(isEqualVariableArray<number>([1, 2], [1, 2], [1, 2]))
function selectionSort(array: number[]) {
for (let last = array.length - 1; last > 0; last--) {
const largest = array.slice(0, last + 1).sort()[last];
const largestIndex = array.findIndex((item) => item === largest);
array[largestIndex] = array[last];
array[last] = largest;
}
return array;
}
@mu-hun
mu-hun / 학교생활 속 불편함 줄이기.md
Last active October 24, 2025 08:43
마이크로소프트웨어 399호 “자동화의 광시곡” — “학교 생활 속 불편함 줄이기”, 2020.01, 개정 2판 → https://www.frontend.moe/posts/maso-399/

학교생활 속 불편함 줄이기

유저 스크립트에서 서비스 제작까지

주니어 인터렉션 마법사. 적당한 버전 관리 프로그램을 찾다가 깃(Git)을 다루게 되면서 프로그래밍을 필연적으로 시작했다.

새 학기마다 어떤 사이드 프로젝트를 진행할 지 심각하게 고민을 하고 있다.

유저 스크립트 소개

import { FormEvent } from 'react'
export interface TypeForm extends FormEvent<HTMLFormElement> {}