Skip to content

Instantly share code, notes, and snippets.

View ENvironmentSet's full-sized avatar

Jaewon Seo ENvironmentSet

View GitHub Profile
@ENvironmentSet
ENvironmentSet / Future.js
Last active May 5, 2018 16:18
10๋ถ„์ด๋ฉด ์—ฌ๋Ÿฌ๋ถ„๋„ Future Monad๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
module.exports = ( () => {
const STATE = { PENDING: 0, DONE: 1, FAIL: 2};
class Future {
constructor(worker) {
this.state = STATE.PENDING;
this.value = undefined;
this.handlers = [];
try{
worker(Future.resolver(this), Future.rejector(this));
} catch (error) {
@ENvironmentSet
ENvironmentSet / Promise.md
Last active May 6, 2018 15:15
ECMA-262 8th edition์˜ Promise์— ๊ด€ํ•œ ๋‚ด์šฉ๋“ค์„ ๋ฒˆ์—ญํ•œ ๋ฌธ์„œ

์ด ๋ฒˆ์—ญ๋ณธ์˜ ์ €์ž‘๊ถŒ์€ TC39์—๊ฒŒ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ณ ์œ ๋ช…์‚ฌ์˜ ๊ฒฝ์šฐ, ๋Œ€์‘ํ•˜๋Š” ๋งˆ๋•…ํ•œ ๋‹จ์–ด๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ์—๋Š” ์˜์–ด ํ‘œ๊ธฐ๋ฅผ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ดํผ๋งํฌ์˜ ๊ฒฝ์šฐ ์ œ๊ฑฐํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ์˜ค์—ญ, ์˜์—ญ์ด ์กฐ๊ธˆ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๋ถ€๋ถ„์€ ์–‘ํ•ด ๋ฐ”๋ž๋‹ˆ๋‹ค.

25.4 Promise ๊ฐ์ฒด

Promise๋Š” ๋ฏธ๋ค„์ง„ ๊ณ„์‚ฐ์˜ ๊ฒฐ๊ณผ๋ฅผ ๋‚˜ํƒ€๋‚ด๊ธฐ์œ„ํ•œ placeholder ๋กœ์„œ ์“ฐ์ด๋Š” ๊ฐ์ฒด์ž…๋‹ˆ๋‹ค.

๋ชจ๋“  Promise ๊ฐ์ฒด๋Š” ์•„๋ž˜์˜ ์„ธ ๊ฐ€์ง€ ์ƒํƒœ ์ค‘ ํ•˜๋‚˜์˜ ์ƒํƒœ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. : ์ดํ–‰๋จ(fufilled), ๊ฑฐ์ ˆ๋จ(rejected), ๋Œ€๊ธฐ์ค‘(pending)

@ENvironmentSet
ENvironmentSet / Stack.go
Created May 12, 2018 06:26
Simple Stack based on Go slice
package main
import "fmt"
type any interface {}
type Stack []any
func (stack *Stack) Push(elements ...any) Stack {
for _, element:= range elements {
@ENvironmentSet
ENvironmentSet / ebnfLink.md
Created May 18, 2018 15:31
Whole EBNF gist links for Tteok
@ENvironmentSet
ENvironmentSet / identifier.md
Last active May 18, 2018 15:38
EBNF of identifier
alphabet ::= A-z
alphabets ::= alphabet alphabets | nothing
number ::= 0-9
numbers ::= number numbers | nothing
specialChar ::= _ | ?
specialChars ::= specialChar specialChars | nothing
identifierHead ::= specialChar | alphabet
identifierBody ::= alphabets | numbers | specialChars
identifierBodys ::= identifierBody identifierBodys | nothing
@ENvironmentSet
ENvironmentSet / literals.md
Last active May 20, 2018 14:45
EBNF of literals
numPrefix ::= 0x | 0b | 0o | nothing
floatNumber ::= numbers . numbers
fullNumber ::= numPrefix numbers | floatNumber
char ::= utf 8 char
chars ::= char chars | nothing
fullString ::= " chars "
@ENvironmentSet
ENvironmentSet / history-tteok.md
Created June 5, 2018 14:54
History Of Tteok

History Of Tteok

@ENvironmentSet
ENvironmentSet / container.md
Last active June 6, 2018 08:54
EBNF of container

EBNF of identifier
EBNF of literal
์—ฐ์†๋œ 2๊ฐœ ์ด์ƒ์˜ space๋Š” ํ•œ๊ฐœ์˜ space๋กœ ์น˜ํ™˜๋ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ์ค„์€ trim ๋ฉ๋‹ˆ๋‹ค.(์ค„์˜ ์ฒซ ๋ฒˆ์งธ ๋ฌธ์ž๊ฐ€ space๊ฐ€ ์•„๋‹ˆ๊ณ , ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰ ๋ฌธ์ž๊ฐ€ space๊ฐ€ ์•„๋‹ ๋•Œ ๊นŒ์ง€ ๋ชจ๋“  space๋ฅผ ์ œ๊ฑฐํ•จ์„ ์˜๋ฏธ.)

space ::= 'utf8 space character'
spaces ::= space spaces
expressions ::= expression spaces expressions
expression ::= container | literal | nothing
@ENvironmentSet
ENvironmentSet / readme.md
Last active October 29, 2018 08:55
callbag korean readme

Origin

Callbag ๐Ÿ‘œ

๊ฐ€๋ฒผ์šด Observable ๊ณผ Iterable์„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ์ฝœ๋ฐฑ์„ ์œ„ํ•œ ํ‘œ์ค€

  • ์ตœ์†Œํ•œ์˜ ์˜ค๋ฒ„ํ—ค๋“œ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์ŠคํŠธ๋ฆผ, Iterable, Observable, AsyncIterable ๋“ฑ
  • Modular (๊ฐ๊ฐ์˜ ์˜คํผ๋ ˆ์ดํ„ฐ๋Š” ๊ทธ ์ž์ฒด๋กœ ํ•˜๋‚˜์˜ npm ํŒจํ‚ค์ง€์ž…๋‹ˆ๋‹ค.)
  • ๊ฐ€๋ฒผ์›€ (์ ์€ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น)
  • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค, ๊ทธ์ € ํ‘œ์ค€์ผ ๋ฟ์ž…๋‹ˆ๋‹ค. (๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ฐพ๊ณ  ๊ณ„์‹ ๋‹ค๋ฉด callbag-basics์„ ํ™•์ธํ•˜์‹œ๊ฑฐ๋‚˜ ์œ„ํ‚ค๋ฅผ ํ™•์ธํ•ด ์ฃผ์„ธ์š”.)
@ENvironmentSet
ENvironmentSet / readme.md
Last active October 29, 2018 09:22
callbag-basic korean readme

Origin

Callbag basics ๐Ÿ‘œ

๊ธฐ๋ณธ์ ์ธ callbag ํŒฉํ† ๋ฆฌ์™€ ์˜คํผ๋ ˆ์ดํ„ฐ๋“ค์„ ์ œ๊ณตํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค.

callbag-basics ์€ callbag ์ด๋ผ๋Š” ๋ช…์„ธ๋ฅผ ๋”ฐ๋ฅด๋Š” ํ•จ์ˆ˜๋“ค์„ ๊ตฌํ˜„ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์š”.

Callbag ์€ ๋ง์ด์ฃ ..: