Skip to content

Instantly share code, notes, and snippets.

View hmmhmmhm's full-sized avatar
🚀
Go MARS!!

hmmhmmhm hmmhmmhm

🚀
Go MARS!!
View GitHub Profile
@hmmhmmhm
hmmhmmhm / carousel.html
Created October 25, 2018 12:50
WaterwheelCarousel Resize
const puppeteer = require('puppeteer');
const logger = require('./logger');
const Pool = require('./pool');
const LRU = require("lru-cache");
var browserErrorCount = 0;
var collectInterval = null;
var hitInterval = null;
async function pageAccelerate(page){
@hmmhmmhm
hmmhmmhm / model.js
Last active November 21, 2019 14:17
model.js
// require('./product')
module.exports = (sequelize, DataTypes) => (
sequelize.define('product', {
codeNumber: {
type: DataTypes.STRING(50),
allowNull: false,
},
kind: {
type: DataTypes.STRING(20),
allowNull: false,
@hmmhmmhm
hmmhmmhm / index.ts
Created March 10, 2020 08:45
moment ts, typescript 한국어 설정 (모멘트 타입스크랩트 한국어 설정 방법)
import "moment/locale/ko"
import * as moment from 'moment'
moment.locale('ko')
console.log(moment.default().format('MM-DD ddd')) // 03-10 화
@hmmhmmhm
hmmhmmhm / iOSZoomPrevent.ts
Created March 18, 2020 08:15
iOSZoomPrevent.ts
// iOS Pinch Zoom 끄기
document.documentElement.addEventListener(
'touchstart',
(event) => {
if (event.touches.length > 1) {
event.preventDefault()
}
},
false
@hmmhmmhm
hmmhmmhm / firebase-push-message-send-node-js-example.ts
Created March 31, 2020 02:14
firebase-push-message-send-node-js-example.ts
import * as FirebaseAdmin from 'firebase-admin'
import * as serviceAccount from '../~~.json'
FirebaseAdmin.initializeApp({
// @ts-ignore
credential: FirebaseAdmin.credential.cert(serviceAccount),
})
export const sendPushMessage = async (
notification: {
/*
Windows 10 일부 버전 + XP버전에서 JSON 파일을 메모장으로
수정한 사람의 경우 utf8 로 저장해도 utf8 with BOM 이라는
형식으로 저장이되는데 이형식특이한게 최초에 이상한 글자를 추가해서
fs 가 삑살나서 터집니다, 이 오류를 수정하려면 아래 코드를 쓰면 됩니다.
*/
fs.readFile('./myconfig.json', 'utf8', function (err, data) {
myconfig = JSON.parse(data.toString('utf8').replace(/^\uFEFF/, ''))
})
// 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 / 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