Skip to content

Instantly share code, notes, and snippets.

View hmmhmmhm's full-sized avatar
๐Ÿงฏ
BURNING!!

<hmmhmmhm/> hmmhmmhm

๐Ÿงฏ
BURNING!!
View GitHub Profile
// VirtualFileInput
type FileCallbackType = (
event: {
file: File
thumbnail: string | ArrayBuffer | null
getFormData: (name: string) => FormData
} | void
) => void
@hmmhmmhm
hmmhmmhm / deepSeaScan.js
Created May 22, 2020 08:58
DEEP SEA SCANNER
/**
* @description
*
* ๋ธŒ๋ผ์šฐ์ €์—์„œ ํŠน์ • ์˜ค๋ธŒ์ ํŠธ ์•ˆ์— ํŠธ๋ฆฌํ˜•ํƒœ๋กœ
* ์กด์žฌํ•˜๋Š” ๊ฐ์ฒด๋“ค๊ณผ ํ•จ์ˆ˜์— ์ ‘๊ทผํ•ด์„œ key ๋ฅผ ์ฐพ์•„๋ƒ…๋‹ˆ๋‹ค.
*
* In the browser, access objects and functions that exist
* in tree form within a specific object to find the key.
*
* @param targetObject Object
@hmmhmmhm
hmmhmmhm / sigungu.json
Last active March 7, 2025 15:59
ํ•œ๊ตญ์˜ ๋ชจ๋“  ์‹œ/๊ตฐ/๊ตฌ ์ „๊ตญ ์ง€์—ญ ์ขŒํ‘œ JSON ๋Œ€ํ•œ๋ฏผ๊ตญ ์ง€์—ญ ์ขŒํ‘œ pre_rendered
{
"์„œ์šธํŠน๋ณ„์‹œ/๊ฐ•๋‚จ๊ตฌ": {
"lat": "37.4951",
"long": "127.06278"
},
"์„œ์šธํŠน๋ณ„์‹œ/๊ฐ•๋™๊ตฌ": {
"lat": "37.55274",
"long": "127.14546"
},
"์„œ์šธํŠน๋ณ„์‹œ/๊ฐ•๋ถ๊ตฌ": {
@hmmhmmhm
hmmhmmhm / cors_pattern.ts
Last active May 31, 2020 14:59
Code to allow CORS only for valid domain patterns, ์œ ํšจํ•œ ๋„๋ฉ”์ธ ํŒจํ„ด๋งŒ CORS ํ—ˆ์šฉํ•˜๋Š” ์ฝ”๋“œ
import matcher from 'matcher'
import CORS from 'cors'
let corsOptions = {
origin: (origin, callback) => {
let allow = false
for (let allowAccessDomain of settingsData.allowAccessDomains) { // [ "*.mydomain.com"]
if (matcher.isMatch(origin, allowAccessDomain)) {
allow = true
break
@hmmhmmhm
hmmhmmhm / moment_diff.ts
Last active June 1, 2020 05:17
๋ชจ๋ฉ˜ํŠธ๋ฅผ ํ†ตํ•œ์‹œ๊ฐ„ ๊ฐ’ ๋น„๊ต ์‹œ format ์ ์šฉ๋ฐฉ๋ฒ•
import moment from 'moment'
import 'moment-duration-format'
let currentMoment = moment()
let currentMinuteNum = Number(currentMoment.format('mm'))
let nextMin = 1
let _nextContractTime = moment(currentMoment)
.add(nextMin, 'minute')
@hmmhmmhm
hmmhmmhm / svelte_inject_to_html.ts
Created June 8, 2020 07:30
์Šค๋ฒจํŠธ ์ปดํฌ๋„ŒํŠธ๋ฅผ HTML ์—˜๋ ˆ๋จผํŠธ์— ์ฃผ์ž…์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ• (How to inject svelte into the html element)
// @ts-ignore
import SummernoteTab from './SummernoteTab.svelte'
// * ์˜ˆ์‹œ์šฉ ๋”๋ฏธ ๋ณ€์ˆ˜๋“ค
declare var toolbarElement: any
declare var editorElement: any
declare var optionsStore: any
declare var activatedOptionStore: any
declare var tabInstance: any
@hmmhmmhm
hmmhmmhm / crawler.ts
Last active June 13, 2020 02:40
JSDOM ์„ ์ด์šฉํ•œ ๊ฐ„๋‹จํ•œ ssr ํŽ˜์ด์ง€ ํฌ๋กค๋ง ์˜ˆ์‹œ
import axios from 'axios'
import { JSDOM } from 'jsdom'
export const crawling = async (url: string) => {
try {
const response = await axios.get(url)
const { window } = new JSDOM(response.data)
// * ํฌ๋กค๋ง ์ฝ”๋“œ ์‹œ์ž‘
const iframePath = window.document.querySelector('#contentarea_left > iframe').src
@hmmhmmhm
hmmhmmhm / swiper.svelte
Created June 17, 2020 07:42
Swiper JS for Svelte
<script context="module">
const importScript = src => {
return new Promise((resolve, reject) => {
let s = document.createElement('script')
s.addEventListener('load', resolve)
s.type = 'text/javascript'
s.charset = 'utf-8'
s.src = src
let x = document.getElementsByTagName('script')[0]
if (x.parentNode) x.parentNode.insertBefore(s, x)
@hmmhmmhm
hmmhmmhm / geohash_query.ts
Created June 19, 2020 03:47
Geohash ๊ทธ๋ฃนํ•‘ ๋ฐ ์ฟผ๋ฆฌ ๋ฐฉ๋ฒ• (๊ฐ€๊นŒ์šด ์œ„์น˜์˜ ์ •๋ณด ์–ป์–ด์˜ฌ๋•Œ)
import ngeohash from 'ngeohash'
import sortByDistance from 'sort-by-distance'
import { readFileSync } from 'fs'
export const geoQuery = async ({
x,
y,
rangeMeter = 70000, // ๋ฒ”์œ„ (๋ฏธํ„ฐ))
limit = 50, // ์ฟผ๋ฆฌ ๊ฒฐ๊ณผ๋ฌผ ๊ฐฏ์ˆ˜
memGeo,
@hmmhmmhm
hmmhmmhm / login.ts
Last active July 17, 2020 09:22
NAVER Login for Backend CSR ๋„ค์ด๋ฒ„ ์•„์ด๋”” ๋กœ๊ทธ์ธ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์˜ˆ์ œ ์˜ˆ์‹œ Node.JS ์ด๋ ‡๊ฒŒ ํ•ด๋†“์œผ๋ฉด ๊ตฌ๊ธ€์—์„œ ๊ฒ€์ƒ‰์ด ๋˜๋ ค๋‚˜
let clientId = ''
let clientSecret = ''
let token = ''
let randomId = '' // ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ์ „๋‹ฌ๋  ๊ฐ’
const naverLogin = async () => {
let accessTokenRequestURL = `https://nid.naver.com/oauth2.0/token?client_id=${clientId}&client_secret=${clientSecret}&grant_type=authorization_code&state=${randomId}&code=${token}`
let auctualTokenRequestResponse = await axios.get(