Skip to content

Instantly share code, notes, and snippets.

View mu-hun's full-sized avatar
💡
No sliver bullet

Mu-Hun mu-hun

💡
No sliver bullet
View GitHub Profile
@mu-hun
mu-hun / mma.user.js
Last active October 24, 2025 04:50
병무청 병역일터 검색
// ==UserScript==
// @name 병무청 병역일터 검색
// @version 1
// @grant none
// @match https://work.mma.go.kr/caisBYIS/search/byjjecgeomsaek.do
// @match https://work.mma.go.kr/caisBYIS/search/cygonggogeomsaek.do
// @run-at document-idle
// ==/UserScript==
@mu-hun
mu-hun / 4.1.2.js
Created September 30, 2020 05:07
YDKJS generator example
let z = 1;
function *foo() {
const x = yield 2;
z++
const y = yield (x*z)
console.log(x, y, z)
}
const it_first = foo()
@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;
}