Skip to content

Instantly share code, notes, and snippets.

View leegeunhyeok's full-sized avatar
🎯
Focusing

Aiden Lee leegeunhyeok

🎯
Focusing
View GitHub Profile
const globalMachine = Machine(
{
predictableActionArguments: true,
initial: 'idle',
context: {
user: null,
},
states: {
@leegeunhyeok
leegeunhyeok / machine.js
Last active January 28, 2023 17:52
Generated by XState Viz: https://xstate.js.org/viz
const TAG = 'GlobalMachine';
const AsyncStorage = localStorage;
Machine(
{
id: TAG,
initial: 'idle',
context: {
user: null,
},
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
export TERM=xterm-256color
unsetopt nomatch
# Set name of the theme to load --- if set to "random", it will
@leegeunhyeok
leegeunhyeok / ghlee.itermcolors
Last active December 19, 2023 07:27
My iTerm2 profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
@leegeunhyeok
leegeunhyeok / example.tsx
Last active May 6, 2021 17:41
Awesome Logger for React.Profiler
<Profiler id="MyComponent" onRender={console.profile}>
<Component />
</Profiler>
@leegeunhyeok
leegeunhyeok / eval_only_once.js
Created October 8, 2020 05:23
Eval only once
let init = false;
const doSomething = () => {
if (!init && (init = true)) {
console.log('Only once');
return;
}
console.log('Do something');
}
doSomething(); // Only once
@leegeunhyeok
leegeunhyeok / get_week_number.js
Created October 8, 2020 04:06
📅 특정 날짜 기준으로 당월 N주차 구하기
/**
* 특정 날짜 기준으로 당월 N주차 구하기
* @author [email protected]
*/
/**
* 지정된 날짜가 몇 주차인지 계산하여 반환합니다
* @param {Date} dateFrom 주차 계산을 위한 기준 날짜
*/
@leegeunhyeok
leegeunhyeok / pick.js
Last active August 3, 2020 06:40
[출간기념 이벤트] SNS 앱으로 배우는 프로그레시브 웹 앱 - 페이스북 생활코딩 추첨
const PICK = 5; // 추첨 인원
const picked = {}; // 중복 추첨 방지 확인용 객체
const commentCount = $0.childElementCount // 전체 댓글 수
const users = Array.from($0.children).map((comment) => comment.querySelector('[aria-label="Comment"]'));
for (let i = 0; i < PICK; i++) {
let idx = Math.floor(Math.random() * commentCount);
while (picked[idx]) {
idx = Math.floor(Math.random() * commentCount);
}
@leegeunhyeok
leegeunhyeok / popup.css
Created June 29, 2020 16:30
WWDC20 - Safari 14 Web Extension
:root {
color-scheme: light dark;
}
body {
width: 100px;
padding: 10px;
font-family: system-ui;
text-align: center;
}
@leegeunhyeok
leegeunhyeok / popup.html
Created June 29, 2020 16:30
WWDC20 - Safari 14 Web Extension
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="popup.css">
<script type="module" src="popup.js"></script>
</head>
<body>
<strong>Apple Symbol</strong>
<span></span>