Skip to content

Instantly share code, notes, and snippets.

View cometkim's full-sized avatar

Hyeseong Kim cometkim

View GitHub Profile
@cometkim
cometkim / tsserver.js
Last active March 12, 2021 02:08
coc.nvim + tsserver + pnpify (lbrayner/vim-rzip plugin required)
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
@cometkim
cometkim / build-fontset.sh
Last active October 26, 2020 08:54
Font subset script for l10n
#!/bin/bash
set -eux
# borrowed subset range from: https://www.44bits.io/ko/post/optimization_webfont_with_pyftsubnet
OPTS_SUBSET_KO='--text-file=glyphs-ko.txt'
# borrowed subset range from: https://fonts.googleapis.com/css2?family=Prompt&display=swap&subset=thai
OPTS_SUBSET_THAI='--unicodes=U+0E01-0E5B, U+200C-200D, U+25CC, U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB, U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF, U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD'
@cometkim
cometkim / machine.js
Last active November 7, 2020 12:16
Generated by XState Viz: https://xstate.js.org/viz
// 충돌시 데미지
const HIT_DAMAGE = 30;
// 충돌 후 무적 시간
const INVINCIBLE_TIME = 2000;
// 시간당 데미지
const TICK_DAMAGE = 5;
const gameMachine = Machine({
@cometkim
cometkim / main.js
Created September 8, 2020 10:48
The minimal Storybook(v6) configuration for Gatsby + TypeScript + Pnpm
module.exports = {
stories: [
'../src/**/*.stories.mdx',
'../src/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
],
webpackFinal: async config => {
@cometkim
cometkim / xstate-typestate-guard.tsx
Created July 8, 2020 16:11
Type guard for XState
export type UserContext = {
};
type UserSuccessContext = UserContext & {
user: User;
};
type UserErrorContext = UserContext & {
error: Error;
};
@cometkim
cometkim / directives.graphql
Created October 17, 2019 04:43
Prisma 1 directive mock declarations
directive @db(name: String!) on FIELD_DEFINITION | OBJECT
directive @relationTable on OBJECT
directive @id on FIELD_DEFINITION
directive @unique on FIELD_DEFINITION
directive @createdAt on FIELD_DEFINITION
directive @updatedAt on FIELD_DEFINITION
directive @default(value: Any) on FIELD_DEFINITION
directive @relation(link: RelationLink! = TABLE, name: String) on FIELD_DEFINITION
enum RelationLink {
@cometkim
cometkim / Brewfile
Last active April 18, 2019 09:27
Homebrew bundle
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "instantclienttap/instantclient"
tap "jesseduffield/lazygit"
tap "lqez/npk"
cask "java"
cask "java8"
brew "ansible"
@cometkim
cometkim / weekOfMonth.js
Created February 6, 2019 17:26
특정 날짜가 그 달의 몇 번 째 주차인지 계산하기
const format = require('date-fns/format')
const startOfWeek = require('date-fns/start_of_week')
const today = new Date()
// 시작일이 포함되는 주의 수요일(3)의 포함 달을 기준으로 주차를 계산
const baseDate = startOfWeek(today, { weekStartsOn: 3 })
const baseMonth = baseDate.getMonth() + 1
const baseDays = baseDate.getDate() + 1
@cometkim
cometkim / main.go
Created January 13, 2019 19:26
qor admin with echo
package main
import (
"fmt"
"github.com/jinzhu/gorm"
"github.com/labstack/echo"
_ "github.com/mattn/go-sqlite3"
"github.com/qor/admin"
"github.com/qor/auth"

Keybase proof

I hereby claim:

  • I am cometkim on github.
  • I am cometkim (https://keybase.io/cometkim) on keybase.
  • I have a public key whose fingerprint is 2B85 48C5 818C B14B 2F77 A69A 3EE3 B2AA 5C23 ABBF

To claim this, I am signing this object: