Skip to content

Instantly share code, notes, and snippets.

View MaetDol's full-sized avatar

MaetDol MaetDol

  • South Korea
View GitHub Profile
@MaetDol
MaetDol / volumetric-clouds.glsl
Created November 13, 2023 12:35 — forked from dolanor/volumetric-clouds.glsl
Volumetric clouds GLSL webGL
// 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);
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 )
class PromisePool {
constructor( limit ){
this.limit = limit;
this.onBoardSize = 0;
this.pool = [];
}
// 이부분을 어찌어찌 수정?
push( producer, size=1 ){
@MaetDol
MaetDol / async_test.js
Last active July 7, 2021 02:19
Async, Promise, Generator practice
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);
@MaetDol
MaetDol / findAllIndices.js
Last active January 12, 2021 10:52
Find indices of target number from 2D array
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) => {
function debounce(fnc, delay) {
let timeoutId = undefined;
return (...args) => {
clearTimeout(timeoutId);
timeoutId = setTimeout( _=> {
fnc(...args);
}, delay );
};
}
@MaetDol
MaetDol / codespitz_3rd_3-3.js
Last active January 1, 2021 14:05
코드 스피츠 3rd-3 ES6+ 함수와 OOP 3회차 과제
/**
* Codespitz 3rd-3 ES6+ 함수와 OOP 3회차
* TODO: 1:03:11 지점
* - 완료 - 재귀함수로 구현하기(스택을 제거하기)
* - 완료 - JSON 파서로 만들기
*/
//# sourceURL=jsonParser.js
const parser = input => {
@MaetDol
MaetDol / copy_mdn_heading_link.js
Created December 8, 2020 03:57
Copy anchor link by click mdn headings
// 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 );
}