Skip to content

Instantly share code, notes, and snippets.

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

hmmhmmhm hmmhmmhm

🚀
Go MARS!!
View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active July 22, 2024 08:58
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@hmmhmmhm
hmmhmmhm / gpt-numbers-station.js
Last active March 8, 2024 05:37
Random Numbers Broadcasting by GPT
const encodingTable = {
"A": "퐀", "a": "퐚", "B": "퐁", "b": "퐛", "C": "퐂", "c": "퐜", "D": "퐃", "d": "퐝",
"E": "퐄", "e": "퐞", "F": "퐅", "f": "퐟", "G": "퐆", "g": "퐠", "H": "퐇", "h": "퐡",
"I": "퐈", "i": "퐢", "J": "퐉", "j": "퐣", "K": "퐊", "k": "퐤", "L": "퐋", "l": "퐥",
"M": "퐌", "m": "퐦", "N": "퐍", "n": "퐧", "O": "퐎", "o": "퐨", "P": "퐏", "p": "퐩",
"Q": "퐐", "q": "퐪", "R": "퐑", "r": "퐫", "S": "퐒", "s": "퐬", "T": "퐓", "t": "퐭",
"U": "퐔", "u": "퐮", "V": "퐕", "v": "퐯", "W": "퐖", "w": "퐰", "X": "퐗", "x": "퐱",
"Y": "퐘", "y": "퐲", "Z": "퐙", "z": "퐳"
};
@hmmhmmhm
hmmhmmhm / packing.ts
Last active November 1, 2021 07:21
typescript grid item sort & align algorithm
export interface PackNode {
w: number
h: number
x?: number
y?: number
used?: boolean
right?: PackNode
down?: PackNode
fit?: PackNode
}
@hmmhmmhm
hmmhmmhm / googleTTS.ts
Created June 20, 2021 06:30
구글 TTS API 자바스크립트 & 타입스크립트 예제 (Google TTS API Javascript & Typescript Usage)
// How To Authentication: https://cloud.google.com/docs/authentication/getting-started#auth-cloud-implicit-nodejs
import textToSpeech from '@google-cloud/text-to-speech'
import fs from 'fs'
import util from 'util'
// Creates a client
const client = new textToSpeech.TextToSpeechClient()
const getTTSContent = async (props: {
@hmmhmmhm
hmmhmmhm / clovaTTS.ts
Created June 20, 2021 06:04
네이버 클로바 TTS API 자바스크립트 & 타입스크립트 사용법 (Naver Clova TTS API Javascript & Typescript Usage)
import axios from 'axios'
import path from 'path'
import fs from 'fs'
import querystring from 'qs'
import { Readable } from 'stream'
export const Speakers = [
/**
* 다인 (여아 목소리)
*/
@hmmhmmhm
hmmhmmhm / fpe.ts
Last active June 20, 2021 07:49
javascript format preserving
import fe1 from 'node-fe1-fpe'
export interface IFPESetting {
min: number
max: number
privateKey: string
publicKey: string
}
export const encrypt = ({
@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(
@Brandawg93
Brandawg93 / google_login.ts
Last active June 25, 2024 05:15
Login to Google Account via Puppeteer
import puppeteer from 'puppeteer-extra';
import pluginStealth from 'puppeteer-extra-plugin-stealth'; // Use v2.4.5 instead of latest
import * as readline from 'readline';
puppeteer.use(pluginStealth());
// Use '-h' arg for headful login.
const headless = !process.argv.includes('-h');
// Prompt user for email and password.
@sonbyungjun
sonbyungjun / viewKorean.ts
Created June 2, 2020 02:40
Typescript(Javascript) conversion of amount into Korean Function (타입스크립트(자바스크립트) 금액 한글로 변환 함수)
export const viewKorean = (num: any): string => {
num = parseInt((num + '').replace(/[^0-9]/g, ''), 10) + '';
if (num == '0') return '영';
let number = ['영', '일', '이', '삼', '사', '오', '육', '칠', '팔', '구'];
let unit = ['', '만', '억', '조'];
let smallUnit = ['천', '백', '십', ''];
let result = [];
let unitCnt = Math.ceil(num.length / 4);
num = num.padStart(unitCnt * 4, '0');
let regexp = /[\w\W]{4}/g;
@nnnnnoel
nnnnnoel / func.js
Created June 2, 2020 02:38
React Native toCommaNumber
export function removeDot(str: string): string {
return str.replace(/(^0)(?=[^.])/, '');
}
export function replComma(str: string): string {
return removeDot(str.replace(/(^[\d,]+\.(?:\d*[^0])?)(0*)$/, '$1').replace(/\.$/, ''));
}
export function addComma(str: string): string {
return str.replace(/\B(?=(\d{3})+(?!\d))/g, ',');