Skip to content

Instantly share code, notes, and snippets.

View bigsaigon333's full-sized avatar
🏋️

김동희 bigsaigon333

🏋️
View GitHub Profile
@bigsaigon333
bigsaigon333 / Calc_과제1,2,3.kt
Last active June 6, 2022 05:47
코드스피츠 90회차 1강 과제
import java.util.*
val trim = """[^.\d-+*()/]""".toRegex()
fun trim(v: String): String = v.replace(trim, "")
val MtoPM = """(?<!^|[*/(])-""".toRegex()
fun repMtoPM(v: String): String = v.replace(MtoPM, "+-")
@bigsaigon333
bigsaigon333 / List.js
Last active October 7, 2021 08:10
Array.prototype.{map, reduce, join} 에 착안한 선언적 리액트 컴포넌트 만들기
const arr = [
{ id: 1, text: "abc" },
{ id: 2, text: "def" },
{ id: 3, text: "ghi" },
];
const Map = ({ list, children }) => <>{list.map((el) => children(el))}</>;
const Join = ({ separator, children }) => {
// const [Frag] = React.Children.toArray(children);
@bigsaigon333
bigsaigon333 / useInterval.test.ts
Created August 19, 2021 10:49
useInterval hook 테스트하기
import { renderHook } from "@testing-library/react-hooks/dom";
import useInterval from "./useInterval";
jest.useFakeTimers();
jest.spyOn(globalThis, "setInterval");
jest.spyOn(globalThis, "clearInterval");
afterEach(() => {
jest.clearAllMocks();
});
@bigsaigon333
bigsaigon333 / objectStringify.js
Created April 17, 2021 16:26
Code Spitz JS Study 89회 4/8회차 과제 제출 - 김동희(Donghee Kim)
// 0. 공통모듈
const EMPTY = {};
const err = message => { throw new Error(message); };
const validateObj = (obj) => {
if (typeof obj !== 'object') err(`Invalid type: ${String(obj)} ${typeof obj}`);
};