Skip to content

Instantly share code, notes, and snippets.

View mununki's full-sized avatar
👨‍💻
Reasoning

woonki mununki

👨‍💻
Reasoning
View GitHub Profile
type rec navigation
and route = {@as("key") routeKey: string, name: string, params: params, state: state}
and params = {url?: string}
and state = {
@as("type") _type?: string,
@as("key") stateKey: string,
routeNames: array<string>,
routes: array<route>,
index: int,
stale: bool,
@mununki
mununki / ReFormFieldArrayPOC.res
Created December 2, 2022 06:32
ReForm field array validation example
module ProfileFormFields = %lenses(
type t = {
nickname: string,
age: int,
}
)
module FormFields = %lenses(
type state = {
name: string,
@mununki
mununki / subString.res
Created April 19, 2022 14:59
프로그래머스 5 - 좋은 부분 문자열
// 좋은 부분 문자열
// 좋은 부분 문자열이란 어떤 문자열 s의 부분 문자열이면서 같은 알파벳이 두 번 이상 나타나지 않는 문자열을 말합니다.
// 예를들어 주어진 문자열이 "abac" 일 때, 부분 문자열 "a", "ab", "bac"등은 원래 문자열 "abac" 의 부분 문자열이면서
// 문자열 내에 같은 알파벳이 두 번 이상 나타나지 않으므로 좋은 부분 문자열입니다. 그러나 "aba", "abac"는 문자열 내에
// 같은 알파벳 'a'가 두 번 이상 나타나므로 좋은 부분 문자열이 아닙니다. 문자열 s가 주어질 때 좋은 부분 문자열의 개수를
// return 하도록 solution 함수를 완성해주세요.
// "abac" => "a", "b", "c", "ab", "ba", "ac", "bac"
// "abcd" => "a", "b", "c", "d", "ab", "bc", "cd", "abc", "bcd", "abcd"
@mununki
mununki / quadTree.res
Last active April 20, 2022 16:32
프로그래머스 코테 - 쿼드트리
open Belt
module QuadTree = {
exception Invalid_Operation(string)
// P(ne, nw, sw, se)
type rec t = P(t, t, t, t) | White | Black | Empty
let empty = () => Empty
let fromString = s =>
@mununki
mununki / chess.res
Last active April 18, 2022 18:11
프로그래머스 코테 - 체스
open Belt
module rec Board: {
type rec t
and coord = (row, col)
and size = int
and col
and row
let init: size => t
@mununki
mununki / addBigInt.res
Last active April 18, 2022 18:11
프로그래머스 코테 - 문자열 정수 더하기
open Belt
// 각 문자열의 가장 뒷 글자끼리 정수로 변환하여 더한다.(a)
// 이전 연산의 결과로 넘어온 값 1 or 0 (b)
// 결과 (c)
// (a + b)가 10 미만인 경우 c 에 prepend 하고, 다음 연산(next)에 0을 넘겨준다.
// (a + b)가 10 이상인 경우 10을 뺀 값을 c에 prepend 하고, 다음 연산(next)에 1을 넘겨준다.
let toArray = s => s->Js.String2.split("")
@mununki
mununki / gIndex.res
Last active April 18, 2022 18:11
프로그래머스 코테 - 논문 g-index
open Belt
let solution = xs => {
// 인용 횟수를 내림차순으로 정렬합니다. [3, 2, 1, ...]
// g-index가 제일 높은 경우, 논문 N개
// 인용 횟수 배열의 맨 뒤부터 하나씩 sum을 비교하여, sum >= gIndex^2 인 gIndex를 찾습니다.
// 역으로 찾는 이유는 앞에서부터 찾는 경우 중간 이후 다시 조건을 만족하게 되는 경우를 찾을 수 없기 때문입니다.
// [3, 2, 1, ...]
let sorted = xs->List.fromArray->List.sort((a, b) => b - a)->List.toArray
@mununki
mununki / y2021d1.ml
Created December 1, 2021 16:34
Advent of Code 2021, Day 1
let input = Util.read_file "../input/y2021d1" |> List.map int_of_string
(* let%test _ = input = ["1"] *)
(* let%expect_test _ =
input |> List.iter (fun s -> print_endline s);
[%expect ""] *)
let prevs xs = xs |> List.rev |> List.tl |> List.rev
@mununki
mununki / doom.txt
Created April 17, 2021 05:41 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@mununki
mununki / user_password_django_pbkdf2_sha256.go
Last active April 28, 2024 09:40
[Go] Implementation Django default password hashing PBKDF2_SHA256 with Go
import (
"crypto/rand"
"crypto/sha256"
"crypto/subtle"
"encoding/base64"
"strconv"
"strings"
"time"
"golang.org/x/crypto/pbkdf2"