This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parser": "babel-eslint", | |
"parserOptions": { | |
"ecmaVersion": 6, | |
"sourceType": "module", | |
"ecmaFeatures": { | |
"jsx": true, | |
"modules": true, | |
"experimentalObjectRestSpread": true, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"//": "ES2015+ 의 import * from 사용 지원", | |
"allowSyntheticDefaultImports": true, | |
"//": "ES7 데코레이터에 대한 지원 (experimental)", | |
"experimentalDecorators": true, | |
"//": "데코레이터를 사용한 DI 지원 (experimental)", | |
"emitDecoratorMetadata": true, | |
"//": "컴파일에 포함될 라이브러리 (배열로 지정해야함)", | |
"lib": [ "dom", "es5", "es2015", "es2015.promise" ], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = (function() { | |
// 비공개 | |
var age = 25; | |
return { | |
// 공개 | |
name: 'hello', | |
getAge: function() { | |
return age; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Person(name) { | |
// 생성자내에서만 사용가능 | |
var age = 30; | |
this.name = name; | |
// 인스턴스 생성시 계속 생성됨 | |
this.greeting = function() { | |
return this.name; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var todo = (function(){ | |
var tasks = []; | |
var addTask = (function(){ | |
var id = 0; | |
return function(title){ | |
var result = id; | |
tasks.push({id: id++, title: title, state: STATE.PROGRESS()}); | |
render(); | |
return result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Html = function(){}; | |
Html.prototype = new Renderer(); | |
Html.prototype._init = function(){ | |
if(typeof this.completeLi !== 'undefined' && typeof this.progressLi !== 'undefined') { | |
return; | |
} | |
this.progressLi = document.querySelector('#todo .progress li'); | |
this.completeLi = document.querySelector('#todo .complete li'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (var i = 1; i <= 9; i++) { | |
for (var j = 1; j <= 9; j++) { | |
console.log(i, 'X', j, '=', i * j); | |
} | |
} | |
eachDan(7); | |
for (var i = 8; i <= 18; i += 2) eachDan(i); | |
printDan([3, 7, 9, 13]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function(query, target = document) { | |
return target.querySelectorAll(query).length > 1 ? [...target.querySelectorAll(query)] : target.querySelector(query); | |
} | |
function $(query) { | |
return (document.querySelectorAll(query).length >= 2 | |
? Array.from(document.querySelectorAll(query)); | |
: document.querySelector(query)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"editor.detectIndentation": false, | |
"editor.tabSize": 2, | |
"editor.fontFamily": "d2coding ligature", | |
"editor.fontLigatures": true, | |
"editor.fontSize": 16, | |
"editor.formatOnSave": true, | |
"editor.formatOnPaste": true, | |
"editor.formatOnType": false, | |
"editor.insertSpaces": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useRef, useEffect, useCallback } from 'react'; | |
import throttle from 'lodash/throttle'; | |
const useDetectScrollEnd = (endPercent = 0.9) => { | |
const scrollEnded = useRef(false); | |
const [isScrollEnd, setIsScrollEnd] = useState(false); | |
const handleScroll = useCallback(throttle(() => { | |
const { scrollY, innerHeight } = window; | |
const scrollPercent = (scrollY + innerHeight) / document.body.scrollHeight; |
OlderNewer