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
// Created by inigo quilez - iq/2013 | |
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. | |
// Volumetric clouds. It performs level of detail (LOD) for faster rendering | |
float noise( in vec3 x ) | |
{ | |
vec3 p = floor(x); | |
vec3 f = fract(x); | |
f = f*f*(3.0-2.0*f); |
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
const checkAndReturnKeys = ( obj: any[] | Object, root=true ): String[] => { | |
const isArray = obj.constructor.name === 'Array'; | |
const keys = []; | |
for( let [key, value] of Object.entries(obj) ) { | |
key = isArray ? `[${key}]` : `.${key}`; | |
const isObject = value instanceof Object; | |
const subKeys = isObject | |
? checkAndReturnKeys( value, false ).map( k => key + k ) |
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
class PromisePool { | |
constructor( limit ){ | |
this.limit = limit; | |
this.onBoardSize = 0; | |
this.pool = []; | |
} | |
// 이부분을 어찌어찌 수정? | |
push( producer, size=1 ){ |
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 d(delay, label=delay, doReject=false) { | |
return new Promise((resolve, reject) => setTimeout( _=> { | |
console.log( label ); | |
if( doReject ) reject(label); | |
resolve( label ); | |
}, delay)); | |
} | |
await d(1000, 'delayed'); | |
await d(500, undefined, 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
function findAll(val, arr) { | |
return arr.reduce((indices, v, i) => { | |
if( v === val ) indices.push(i); | |
return indices; | |
}, []); | |
} | |
const TARGET = 0; | |
const arr = [[1, 1, 1], [1, 1, 0], [1, 0, 0]]; | |
const indices = arr.reduce( (result, arr, i) => { |
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 debounce(fnc, delay) { | |
let timeoutId = undefined; | |
return (...args) => { | |
clearTimeout(timeoutId); | |
timeoutId = setTimeout( _=> { | |
fnc(...args); | |
}, delay ); | |
}; | |
} |
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
/** | |
* Codespitz 3rd-3 ES6+ 함수와 OOP 3회차 | |
* TODO: 1:03:11 지점 | |
* - 완료 - 재귀함수로 구현하기(스택을 제거하기) | |
* - 완료 - JSON 파서로 만들기 | |
*/ | |
//# sourceURL=jsonParser.js | |
const parser = input => { |
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
document.querySelector('#wikiArticle') | |
.querySelectorAll('h1, h2, h3, h4, h5, h6') | |
.forEach(el => { | |
const linkWithAnchor = `${location.href}#${el.id}`; | |
const writeToClipboard = () => navigator.clipboard.writeText( linkWithAnchor ); | |
el.addEventListener('click', writeToClipboard ); | |
el.style.cursor = 'pointer'; | |
}); |
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
// CodeSpitz 3rd-4 ES6+ 디자인패턴과 뷰패턴 5회차 | |
// 40분 즈음에 나오는 코드의 일부분입니다 | |
class Render { | |
constructor( processor ) { this.p = processor; } | |
render({ task, list }) { | |
this.p.folder( task ); | |
this.p.parent( task ); | |
this.p.subTask( list ); | |
} |