Skip to content

Instantly share code, notes, and snippets.

@im-ian
im-ian / toss-frontend-rules.mdc
Created May 9, 2025 07:14 — forked from toy-crane/toss-frontend-rules.mdc
ํ† ์Šค ํ”„๋ก ํŠธ์—”๋“œ ๊ฐ€์ด๋“œ๋ผ์ธ ๊ธฐ๋ฐ˜์œผ๋กœ ๋งŒ๋“  Cursor rule
# Frontend Design Guideline
This document summarizes key frontend design principles and rules, showcasing
recommended patterns. Follow these guidelines when writing frontend code.
# Readability
Improving the clarity and ease of understanding code.
@im-ian
im-ian / useAnimatedCounter.ts
Last active April 23, 2025 08:26
useAnimatedCounter.ts
import {useState, useEffect, useRef, useCallback} from 'react'
// ์• ๋‹ˆ๋ฉ”์ด์…˜ ํƒ€์ด๋ฐ ํ•จ์ˆ˜
const TIMING_FUNCTIONS = {
linear: (t: number) => t,
easeInOut: (t: number) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2),
easeIn: (t: number) => t * t * t,
easeOut: (t: number) => 1 - Math.pow(1 - t, 3),
bounce: (t: number) => {
const n1 = 7.5625
@im-ian
im-ian / findPath.js
Last active April 23, 2025 08:28
์ฃผ์–ด์ง„ ๊ฐ์ฒด์—์„œ ํŠน์ • ํ‚ค๋ฅผ ์ฐพ์•„ ๊ฒฝ๋กœ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜
/**
* ์ฃผ์–ด์ง„ ๊ฐ’์ด object ํƒ€์ž…์ธ์ง€ ๊ฒ€์‚ฌํ•˜๋Š” ํ•จ์ˆ˜
* @param {*} obj - ๊ฒ€์‚ฌํ•  object
* @returns {boolean} - ๊ฒ€์‚ฌํ•  ๊ฐ’์ด object๋ผ๋ฉด true, ์•„๋‹ˆ๋ผ๋ฉด false๋ฅผ ๋ฐ˜ํ™˜
*/
function isObject(obj) {
return obj !== null && typeof obj === 'object';
}
/**
@im-ian
im-ian / ๋ฒ•์ •์˜๋ฌด๊ต์œก.js
Last active March 20, 2024 01:36
๋ฒ•์ •์˜๋ฌด๊ต์œก์— ์—ด์ค‘ํ•˜๊ณ  ์‹ถ์ง€๋งŒ ์†๊ฐ€๋ฝ์€ ๊นŒ๋”ฑํ•˜๊ธฐ ์‹ซ์œผ์‹  ๋ถ„๋“ค์„ ์œ„ํ•ด์„œ ๊ฐ„๋‹จํ•œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ž‘์„ฑํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.
/**
* ๋ฒ•์ •์˜๋ฌด๊ต์œก์— ์—ด์ค‘ํ•˜๊ณ  ์‹ถ์ง€๋งŒ ์†๊ฐ€๋ฝ์€ ๊นŒ๋”ฑํ•˜๊ธฐ ์‹ซ์œผ์‹  ๋ถ„๋“ค์„ ์œ„ํ•ด์„œ ๊ฐ„๋‹จํ•œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ž‘์„ฑํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.
* ์ฐธ๊ณ ๋กœ ์‹œํ—˜์€ ์ง์ ‘ ์‘์‹œํ•˜์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค :)
* - https://edu.smebiz.co.kr/main/main.php ์‚ฌ์ดํŠธ์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
* - ์˜์ƒ ์žฌ์ƒ ํŒ์—…์—์„œ [๊ฐœ๋ฐœ์ž ๋„๊ตฌ]์˜ [์ฝ˜์†”]์— ์ด ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅ ํ›„ ์‹คํ–‰ํ•ด์ฃผ์„ธ์š”.
*/
const ticker = setInterval(() => {
const $iframe = document.getElementById("mPlayer");
const $context = $iframe.contentDocument;