Skip to content

Instantly share code, notes, and snippets.

View rjcnd105's full-sized avatar
๐Ÿ˜†

๊น€ํšŒ์ค€ rjcnd105

๐Ÿ˜†
View GitHub Profile
@rjcnd105
rjcnd105 / result.ex
Last active October 16, 2025 03:08
simple elixir my result
defmodule Monad.Result do
@type result_t(value, error) :: ok_t(value) | error_t(error)
@type ok_t(a) :: {:ok, a}
@type error_t(a) :: {:error, a}
@spec map(result_t(v, e), (v -> b)) :: result_t(b, e) when v: term(), b: term(), e: term()
def map({:ok, val}, f), do: {:ok, f.(val)}
def map({:error, _val} = err, _f), do: err
@spec map_err(result_t(any(), a), (a -> b)) :: result_t(any(), b) when a: term(), b: term()
@rjcnd105
rjcnd105 / useMobileSize.ts
Created March 20, 2024 05:38
react-use์‚ฌ์šฉ
import { DESKTOP_WIDTH } from '@remember_web/ui';
import { useMedia, useUpdateEffect } from 'react-use';
type UseMobileSizeProps = {
isDefaultMobile?: boolean;
onMediaChange?: (isMobile: boolean) => void;
};
export const useMobileSize = ({
isDefaultMobile = false,
onMediaChange,
/**
* union -> { [k in keyof union]: string} ํƒ€์ž… ๋ณ€ํ™˜
* @example
* MakeObjFromKeys<'studentId' | 'favoriteId', string>
* => { studentId: string; favoriteId: string }
*/
export type MakeObjFromKeys<Keys extends string, V> = { [K in Keys]: V };
const prefix = ':' as const;
export type Prefix = typeof prefix;
import React, { createContext, useCallback, useContext, useMemo, useRef, useSyncExternalStore } from "react";
type MakeStoreProps<T> = {
name: string
initial: T
}
type Subscriber = () => void
type SubscriberStore<T> = {
get() : T
We couldnโ€™t find that file to show.