Skip to content

Instantly share code, notes, and snippets.

View eugenejeonme's full-sized avatar
๐Ÿ‘‹

Eugene Jeon eugenejeonme

๐Ÿ‘‹
View GitHub Profile
@eugenejeonme
eugenejeonme / README.md
Created March 5, 2025 07:01 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@eugenejeonme
eugenejeonme / createFilesObject.mjs
Last active March 11, 2025 12:47
parse-code-blocks-with-gray-matter.mjs (Language: JavaScript) [M] Generated on https://eugenejeon.me/snippet-parse-code-blocks-with-gray-matter-mjs
import getUniqueFileName from './getUniqueFileName.mjs'; // [!code ++]
/**
* ์ฝ”๋“œ ๋ธ”๋ก์—์„œ files ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ํ•จ์ˆ˜
* @param {Array} codeBlocks - parseCodeBlocks ํ•จ์ˆ˜๋กœ ํŒŒ์‹ฑ๋œ ์ฝ”๋“œ ๋ธ”๋ก ๋ฐฐ์—ด
* @param {string} fileTitle - ํŒŒ์ผ ์ œ๋ชฉ (์ฝ”๋“œ ๋ธ”๋ก ์ œ๋ชฉ์ด ์—†์„ ๋•Œ ์‚ฌ์šฉ)
* @returns {Object} - Gist API์— ์ „๋‹ฌํ•  files ๊ฐ์ฒด
*/
function createFilesObject(codeBlocks, fileTitle) {
// Code block ๋‚ด์˜ key ๊ฐ’ ์ค‘๋ณต์„ ์ฒดํฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ
@eugenejeonme
eugenejeonme / slugify.mjs
Last active March 11, 2025 12:47
slugify.mjs (Language: JavaScript) [M] Generated on https://eugenejeon.me/snippet-slugify-mjs
// slugify.js - ESM Version
const charMap = JSON.parse(
// eslint-disable-next-line no-useless-escape
'{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","ยข":"cent","ยฃ":"pound","ยค":"currency","ยฅ":"yen","ยฉ":"(c)","ยช":"a","ยฎ":"(r)","ยบ":"o","ร€":"A","ร":"A","ร‚":"A","รƒ":"A","ร„":"A","ร…":"A","ร†":"AE","ร‡":"C","รˆ":"E","ร‰":"E","รŠ":"E","ร‹":"E","รŒ":"I","ร":"I","รŽ":"I","ร":"I","ร":"D","ร‘":"N","ร’":"O","ร“":"O","ร”":"O","ร•":"O","ร–":"O","ร˜":"O","ร™":"U","รš":"U","ร›":"U","รœ":"U","ร":"Y","รž":"TH","รŸ":"ss","ร ":"a","รก":"a","รข":"a","รฃ":"a","รค":"a","รฅ":"a","รฆ":"ae","รง":"c","รจ":"e","รฉ":"e","รช":"e","รซ":"e","รฌ":"i","รญ":"i","รฎ":"i","รฏ":"i","รฐ":"d","รฑ":"n","รฒ":"o","รณ":"o","รด":"o","รต":"o","รถ":"o","รธ":"o","รน":"u","รบ":"u","รป":"u","รผ":"u","รฝ":"y","รพ":"th","รฟ":"y","ฤ€":"A","ฤ":"a","ฤ‚":"A","ฤƒ":"a","ฤ„":"A","ฤ…":"a","ฤ†":"C","ฤ‡":"c","ฤŒ":"C","ฤ":"c","ฤŽ":"D","ฤ":"d","ฤ":"DJ","ฤ‘":"dj","ฤ’":"E","ฤ“":"e","ฤ–":"E","ฤ—":"e","ฤ˜":"e","ฤ™":"e","ฤš":"E","ฤ›":"e","ฤž":"G","ฤŸ":"g","ฤข":"G","ฤฃ":"g","ฤจ":"I","ฤฉ":"i","ฤช":"i","ฤซ":"i","ฤฎ":"I","ฤฏ":"i","ฤฐ
@eugenejeonme
eugenejeonme / split-filename-regex.mjs
Last active March 11, 2025 12:47
split-filename-regex.mjs (Language: JavaScript) [M] Generated on https://eugenejeon.me/snippet-split-filename-regex-mjs
/**
* Split a file name into its name and extension.
*
* // splitFileNameRegex(fileName: string): { name: string; extension: string | undefined }
* @param {string} fileName The file name to split.
* @returns {Object} An object with the file name and its extension.
* @returns {string} name The name of the file.
* @returns {string | undefined} extension The extension of the file, or undefined if there is no extension.
*/
export default function splitFileNameRegex(fileName) {
@eugenejeonme
eugenejeonme / debounce.ts
Last active March 11, 2025 12:47
Custom debounce implementation in TypeScript based on lodash.debounce (Language: Typescript) [M] Generated on https://eugenejeon.me/snippet-debounce.ts
/**
* Custom debounce based on lodash.debounce.
*
* 1. ๋ถˆํ•„์š”ํ•œ ์ „์—ญ ๊ฐ์ฒด ํƒ์ง€ ์ œ๊ฑฐ:
* freeGlobal๊ณผ freeSelf๋ฅผ ์ œ๊ฑฐํ•˜๊ณ , globalThis๋ฅผ ๊ธฐ๋ณธ์œผ๋กœ ์‚ฌ์šฉํ•˜๋˜, ๋ธŒ๋ผ์šฐ์ € ํ˜ธํ™˜์„ฑ์„ ์œ„ํ•ด ๊ฐ„๋‹จํ•œ ํด๋ฐฑ์„ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค. ํ˜„๋Œ€ ํ™˜๊ฒฝ์—์„œ๋Š” globalThis๊ฐ€ ๋Œ€๋ถ€๋ถ„ ์ง€์›๋˜๋ฏ€๋กœ ์ฝ”๋“œ๊ฐ€ ๊ฐ„๊ฒฐํ•ด์กŒ์Šต๋‹ˆ๋‹ค.
* 2. ํƒ€์ž… ๊ฐœ์„ :
* any ์‚ฌ์šฉ์„ ์ตœ์†Œํ™”ํ•˜๊ณ , unknown๊ณผ ์ œ๋„ค๋ฆญ ํƒ€์ž…์„ ํ™œ์šฉํ•ด ํƒ€์ž… ์•ˆ์ „์„ฑ์„ ๋†’์˜€์Šต๋‹ˆ๋‹ค.
* Parameters<T>์™€ ReturnType<T>๋ฅผ ์‚ฌ์šฉํ•ด ํ•จ์ˆ˜ ์ธ์ž์™€ ๋ฐ˜ํ™˜๊ฐ’์˜ ํƒ€์ž…์„ ์ •ํ™•ํžˆ ์ถ”๋ก ํ•˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.
* 3. ๋ณ€์ˆ˜ ์„ ์–ธ ๊ฐ„์†Œํ™”:
* options ์ฒ˜๋ฆฌ ๋กœ์ง์„ ๊ตฌ์กฐ ๋ถ„ํ•ด ํ• ๋‹น์œผ๋กœ ๊ฐ„์†Œํ™”ํ•ด ๊ฐ€๋…์„ฑ์„ ๋†’์˜€์Šต๋‹ˆ๋‹ค.
@eugenejeonme
eugenejeonme / debounce.js
Last active March 11, 2025 12:47
When calling lodash.debounce using a script tag, I got a 'module is not defined' error, so I rewrote it as a simple function for easier use. (Language: Javascript) [M] Generated on https://eugenejeon.me/snippet-debounce.js
// Generic debounce function
const debounce = function (fn, delay = 16 /* 60fps */) {
let timeout;
return function (...args) {
const context = this;
if (timeout) clearTimeout(timeout);
timeout = setTimeout(() => {
fn.apply(context, args);
}, delay);
@eugenejeonme
eugenejeonme / .coderabbit.yaml
Last active March 11, 2025 12:47
CodeRabbit configuration file for review automation. (Language: YAML) [M] Generated on https://eugenejeon.me/snippet-coderabbit-yaml
# yaml-language-server: $schema=https://storage.googleapis.com/coderabbit_public_assets/schema.v2.json
# original schema url : https://coderabbit.ai/integrations/schema.v2.json
# document url : https://docs.coderabbit.ai/getting-started/configure-coderabbit/
language: 'ko-KR'
early_access: false
reviews:
profile: 'chill'
request_changes_workflow: false
high_level_summary: true
poem: false
interface ColorSelectionOptions {
signal?: AbortSignal
}
interface ColorSelectionResult {
sRGBHex: string
}
interface EyeDropper {
open: (options?: ColorSelectionOptions) => Promise<ColorSelectionResult>
@eugenejeonme
eugenejeonme / alfred_iterm2_script.applescript
Created May 9, 2023 06:53
AppleScript for iTerm2 Alfred integration.
-- Set this property to true to always open in a new window
property open_in_new_window : false
-- Set this property to false to reuse current tab
property open_in_new_tab : true
-- Set this property to true if iTerm is configured to launch without opening a new window
property iterm_opens_quietly : false
-- Handlers
@eugenejeonme
eugenejeonme / alfred_warp_script.applescript
Last active March 16, 2025 14:26
An easy way to use the Warp terminal (https://www.warp.dev/) with Alfred.
-- Set this property to true to always open in a new window
property open_in_new_window : false
-- Set this property to false to reuse the current tab
property open_in_new_tab : true
-- Set start $HOME directory
property open_home_directory : true
-- Handlers