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
@hmmhmmhm
hmmhmmhm / calendar.js
Created October 30, 2018 06:11
moment.js based calendar
import moment from 'moment'
class Calendar{
constructor(paramCalendarDiv, updateCallback) {
this.calendarDiv = paramCalendarDiv
this.monthPage = 0
this.activatedDay = null
this.callbacks = []
this.todayCallbacks = []
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: {
@hmmhmmhm
hmmhmmhm / puppeteer.ts
Last active July 9, 2020 01:04
Anti-Cloudflare Script
import puppeteer from 'puppeteer'
import puppeteerExtra from 'puppeteer-extra'
import pluginStealth from 'puppeteer-extra-plugin-stealth'
import cloudscraper from 'cloudscraper'
import {User} from "../domain/user";
import {accessing} from "../handlers/nasHandler";
let scraper: any = cloudscraper
let browser;
@hmmhmmhm
hmmhmmhm / chunk.ts
Last active June 9, 2021 06:37
Typescript (Javascript) Array Chunk Generator
export const chunk = <T>(array: T[], chunkSize: number) => {
const result: T[][] = []
for (let i = 0; i < array.length; i += chunkSize)
result.push(array.slice(i, i + chunkSize))
return result
}
/*
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/, ''))
})