Skip to content

Instantly share code, notes, and snippets.


Jaewon Seo ENvironmentSet

View GitHub Profile
ENvironmentSet / code.c
Last active July 14, 2022 05:24
View code.c
#include <Adafruit_NeoPixel.h>
#include <TM1637Display.h>
#include <ThreeWire.h>
#include <RtcDS1302.h>
#include <RtcDateTime.h>
#include <math.h>
#define NEOPIXEL_PIN 11
ENvironmentSet / hpack.hsfiles
Created August 5, 2020 13:31 — forked from Ailrun/hpack.hsfiles
Stack templates
View hpack.hsfiles
{-# START_FILE package.yaml #-}
spec-version: 0.31.0
name: {{name}}
# synopsis:
# description:
category: {{category}}{{^category}}Web{{/category}}
author: {{author-name}}{{^author-name}}Author name here{{/author-name}}
View gist:945e5ec5fcfd7cdca1e0deef91b234ba
# First, you must get the previous commit sha, the one before the forced push:
## Hit through terminal
curl -u <username>
# 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>"}'
ENvironmentSet / constraints.ts
Last active August 21, 2020 20:50
Generating eliminator for given constraint in typescript
View constraints.ts
/** If you want to know how to encoding HKTs in typescript, check this:
Sorry for messy names, this was only PoC. **/
export interface HKT {
param: unknown;
result: unknown;
ENvironmentSet / HKT.ts
Last active August 23, 2022 10:49
Encoding HKTs in typescript without declaration merging
View HKT.ts
export interface HKT {
param: unknown;
result: unknown;
interface NotHKT extends HKT {
result: this['param'] extends true ? false : true;
interface FstHKT extends HKT {
ENvironmentSet / any.ts
Last active December 18, 2019 08:25
Type safe any in Typescript
View any.ts
type Any = <B>(f: <A>(a: A) => B) => B; // Instead of forall a. a, use it's continuation. (they're isomorphic)
function any<A>(a: A): Any {
return f => f(a);
ENvironmentSet / st-formal.ts
Last active December 30, 2020 11:13
ST Monad In Typescript
View st-formal.ts
// 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);
ENvironmentSet / cadt.ts
Last active October 24, 2019 12:44
View cadt.ts
data List a = Nil | Cons a (List a)
class Monoid a where
mempty :: a
mappend :: a -> a -> a
instance Monoid (List a) where
mempty = Nil
mappend Nil ys = ys
ENvironmentSet /
Created March 31, 2019 10:07
An Elegant way to define property conditionally

Andrea Simone Costa의 글을 보고 작성한 글 입니다(Andrea의 설명은 읽지 않고 쓰는 글이라 원문과 다르게 설명했을 확률이 높습니다).


spread properties의 문법적, 의미적인 성질을 이용하면 다음과 같이 깔끔하게 조건부로 객체의 프로퍼티를 선언할 수 있습니다.

const condition = true;
const foo = {
ENvironmentSet /
Last active January 30, 2019 23:04
You don't know arguments object
function problem1(a, b, c) {
  arguments[0] = 100;
  return [a, b, c];

problem1(1, 2, 3) // 반환값을 맞추어 보세요!

정답: [100, 2, 3]