Skip to content

Instantly share code, notes, and snippets.

View ENvironmentSet's full-sized avatar
🎯
Focusing on development of hyogwa

Jaewon Seo ENvironmentSet

🎯
Focusing on development of hyogwa
View GitHub Profile
@DmitrySoshnikov
DmitrySoshnikov / ES7 Notes.txt
Last active February 9, 2018 19:42
ES7 Notes
// by Dmitry Soshnikov
ES7:
== Lexical environment ==
- Environment Record
- parent (can be null)
== Environment Record ==
@ENvironmentSet
ENvironmentSet / constraints.ts
Last active August 21, 2020 20:50
Generating eliminator for given constraint in typescript
/** If you want to know how to encoding HKTs in typescript, check this:
https://gist.github.com/ENvironmentSet/1662a140f99381bc85fd6be51ecdcbb5
Sorry for messy names, this was only PoC. **/
export interface HKT {
param: unknown;
result: unknown;
}
@ENvironmentSet
ENvironmentSet / st-formal.ts
Last active December 30, 2020 11:13
ST Monad In Typescript
// Sorry for poor naming, this example was intented to explain how to use skolem capturing in practise.
interface Stateful<S, A> {
(state: S): [A, S]
}
function fmap<S, A, B>(f: (a: A) => B): (stateful: Stateful<S, A>) => Stateful<S, B> {
return stateful => state => {
const [a, nextState] = stateful(state);
@epicallan
epicallan / _FP reading lists.md
Created July 4, 2019 16:49 — forked from danidiaz/_FP reading lists.md
assorted reading lists

A series of reading lists mostly related to functional programming.

@ENvironmentSet
ENvironmentSet / HKT.ts
Last active August 28, 2023 04:47
Encoding HKTs in typescript without declaration merging
export interface HKT {
param: unknown;
result: unknown;
}
interface NotHKT extends HKT {
result: this['param'] extends true ? false : true;
}
interface FstHKT extends HKT {
@agarwalparas
agarwalparas / gist:d355a950148702cc7ba82abc4d1943bf
Created November 3, 2017 04:06
Recover Force Push on Github
# First, you must get the previous commit sha, the one before the forced push:
## Hit through terminal
curl -u <username> https://api.github.com/repos/:owner/:repo/events
# Then you can create a branch from this sha:
## Hit through terminal
curl -u <github-username> -X POST -d '{"ref":"refs/heads/<new-branch-name>", "sha":"<sha-from-step-1>"}' https://api.github.com/repos/:owner/:repo/git/refs
@xnuk
xnuk / hyeong.md
Last active February 11, 2024 15:10
난해한 혀엉.... 언어

이 문서가 여기저기 알려짐에 따라, 이곳에 여러가지 댓글이 달리고 있습니다. 개인적으로는 댓글창을 없애버리고 싶지만 그럴 수 없는 터라, 댓글을 달기 전에 한번씩만 더 생각해주셨으면 합니다.

  • 개인적인 감상은 이곳이 아닌 다른 곳에 적어주세요.
  • 동성애 혐오적인 댓글을 달지 마세요.
  • 기타 "난해한 혀엉... 언어"와 관련없는 댓글을 달지 말아주세요.

위 사항들을 포함해 제 마음에 안 드는 댓글들은 임의로 삭제하고 있습니다. 양해 부탁드립니다.


@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@VictorTaelin
VictorTaelin / promise_monad.md
Last active April 28, 2024 13:28
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing