Skip to content

Instantly share code, notes, and snippets.

@jihunleekr
jihunleekr / numberstring.js
Created November 23, 2015 02:12
숫자를 한글발음대로 표기
/**
* 숫자를 한글발음대로 표기
* 구글 스프레드시트에서는 아래의 함수가 없어서 구현함.
* 한글만 지원. (원래 함수는 한자 등의 다양한 타입을 지원함)
*/
function numberstring(num) {
var namesInSeat = ['', '일', '이', '삼', '사', '오', '육', '칠', '팔', '구'],
namesInSeats = ['', '십', '백', '천'],
namesInFourSeat = ['', '만', '억', '조'],
@jihunleekr
jihunleekr / parseNaverBlogPostAndCafePost.js
Last active February 10, 2017 05:43
네이버 블로그글, 까페글의 이미지, 동영상, 키워드 갯수를 세어줍니다. 파이어폭스 콘솔창에서만 실행됩니다.
cd(document.getElementById('screenFrame'));
if(location.href.match(/cafe/)) {
var word = prompt('카운트할 키워드를 입력하세요');
console.log('이미지:', document.getElementById('cafe_main').contentDocument.querySelectorAll('.inbox img[src^="http://cafep"]').length);
console.log('동영상:', document.getElementById('cafe_main').contentDocument.querySelectorAll('.inbox iframe[src^="http://serviceapi"]').length);
var wordList = document.getElementById('cafe_main').contentDocument.querySelectorAll('.inbox')[0].innerText.match(new RegExp(word, 'ig'));
console.log('키워드:', wordList ? wordList.length : 0);
} else {
console.log('이미지:', document.getElementById('mainFrame').contentDocument.querySelectorAll('[id^="post-view"] img[src^="http://postfiles"]').length);
console.log('동영상:', document.getElementById('mainFrame').contentDocument.querySelectorAll('[id^="post-view"] iframe[src^="http://serviceapi"]').length);
@jihunleekr
jihunleekr / addition-chain.js
Last active April 29, 2022 03:47
덧셈사슬 구하기
// 트리 노드
function Node(value, parent = null) {
this.value = value; // 덧셈사슬을 구할 수
this.parent = parent; // 부모 노드
this.count = 0; // 최소덧셈
}
function getAdditionChain(to = 99) {
const minCounts = new Array(to + 1).fill(to);
minCounts[0] = null; // 배열은 1부터 사용합니다.