Skip to content

Instantly share code, notes, and snippets.

Avatar
✖️
currently not available

Jaewon Seo ENvironmentSet

✖️
currently not available
View GitHub Profile
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
#define NEOPIXLE_PIXELCOUNT 60
View hpack.hsfiles
{-# START_FILE package.yaml #-}
spec-version: 0.31.0
name: {{name}}
version: 0.1.0.0
# synopsis:
# description:
category: {{category}}{{^category}}Web{{/category}}
homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme
bug-reports: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}/issues
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> 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
@ENvironmentSet
ENvironmentSet / constraints.ts
Last active Aug 21, 2020
Generating eliminator for given constraint in typescript
View constraints.ts
/** 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 / HKT.ts
Last active May 21, 2022
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
ENvironmentSet / any.ts
Last active Dec 18, 2019
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
ENvironmentSet / st-formal.ts
Last active Dec 30, 2020
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
ENvironmentSet / cadt.ts
Last active Oct 24, 2019
ClassAsADTDefinition
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
ENvironmentSet / readme.md
Created Mar 31, 2019
An Elegant way to define property conditionally
View readme.md

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

요약

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

const condition = true;
const foo = {
@ENvironmentSet
ENvironmentSet / arguments.md
Last active Jan 30, 2019
You don't know arguments object
View arguments.md
function problem1(a, b, c) {
  arguments[0] = 100;
  return [a, b, c];
}

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

정답: [100, 2, 3]