Skip to content

Instantly share code, notes, and snippets.

View namenu's full-sized avatar
🧑‍🌾

Hyunwoo Nam namenu

🧑‍🌾
View GitHub Profile
@namenu
namenu / vega-viz.json
Created May 2, 2023 06:09
Vega/Vega-Lite viz; To load go to https://vega.github.io/editor
This file has been truncated, but you can view the full file.
(ns scratchpad.relay-protocol)
(defprotocol Connection
(next-page [_ opts])
(previous-page [_ opts])
(has-next-page [_ opts])
(has-previous-page [_ opts]))
(defn vector->Connection [v]
@namenu
namenu / Resx.res
Created January 17, 2022 15:02
Resx proposal
module Array = {
let map = (xs: array<'a>, f: 'a => React.element): React.element => {
Belt.Array.map(xs, f)->React.array
}
let mapWithIndex = (xs: array<'a>, f: (int, 'a) => React.element): React.element => {
Belt.Array.mapWithIndex(xs, f)->React.array
}
}
@namenu
namenu / 390.re
Last active November 3, 2020 15:22
Reason Dojo
let partition_by_identity = xs => {
let rec impl = (xs, cur) => {
switch (xs, cur) {
| ([], _) => [cur]
| ([x, ...xs], []) => impl(xs, [x])
| ([x, ...xs], [y, ..._]) =>
if (x == y) {
impl(xs, [x, ...cur]);
} else {
[cur, ...impl(xs, [x])];
@namenu
namenu / qual-salary.json
Last active June 9, 2020 05:57
Stack Overflow survey
[{"lang":"PHP","average-years":6.757539410555175,"median-salary":44880.52568697726,"count":2918,"year":2017},{"lang":"F#","average-years":9.78834355828221,"median-salary":74250.0,"count":163,"year":2017},{"lang":"Python","average-years":7.105820105820106,"median-salary":61505.37634408607,"count":3213,"year":2017},{"lang":"Objective-C","average-years":7.767682926829268,"median-salary":60411.29032258062,"count":820,"year":2017},{"lang":"Scala","average-years":7.619961612284069,"median-salary":66000.0,"count":521,"year":2017},{"lang":"Ruby","average-years":7.178540772532189,"median-salary":68333.33333333331,"count":1165,"year":2017},{"lang":"Rust","average-years":7.069565217391304,"median-salary":73333.33333333337,"count":115,"year":2017},{"lang":"JavaScript","average-years":7.470875048758289,"median-salary":56774.19354838705,"count":7691,"year":2017},{"lang":"Swift","average-years":7.136734693877551,"median-salary":60500.00000000001,"count":735,"year":2017},{"lang":"R","average-years":7.33659217877095,"median-s
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@namenu
namenu / Chap8.idr
Last active February 26, 2020 13:09
tdd-idris
import Vector
-- 8.3
total
headUnequal : DecEq a => {xs : Vector n a} -> {ys : Vector n a} ->
(contra : (x = y) -> Void) -> ((x::xs) = (y::ys)) -> Void
headUnequal contra Refl = contra Refl
total
(ns interval-tree
(:require [clojure.spec.alpha :as s]))
;; augmented 1-D interval tree
(defrecord ^:private Node [interval highest left right])
(defn insert [{:keys [interval highest left right] :as tree} [vlow vhigh :as value]]
(if (nil? tree)
(Node. value vhigh nil nil)
@namenu
namenu / keybase.md
Created July 2, 2019 17:58
keybase.md

Keybase proof

I hereby claim:

  • I am namenu on github.
  • I am namenu (https://keybase.io/namenu) on keybase.
  • I have a public key whose fingerprint is 50BA 7CF6 A83C A23B 15B8 39CC EA0C 0066 44CC EE7C

To claim this, I am signing this object:

@namenu
namenu / ListReverse.js
Created September 6, 2018 17:14
Reverse a linked list
// Q. Reverse a linked list.
// What is linked list?
const cons = h => t => f => f(h)(t)
// What is boolean?
const T = a => b => a
const F = a => b => b
// What is integer?