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 / useScroll.js
Created June 28, 2021 06:40 — forked from joshuacerbito/useScroll.js
Custom React hook for listening to scroll events
/**
* useScroll React custom hook
* Usage:
* const { scrollX, scrollY, scrollDirection } = useScroll();
*/
import { useState, useEffect } from "react";
export function useScroll() {
const [lastScrollTop, setLastScrollTop] = useState(0);
@hmmhmmhm
hmmhmmhm / google_login.ts
Created July 21, 2023 00:55 — forked from Brandawg93/google_login.ts
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.
// Copy-paste into your console (or minify and save as a bookmarklet) to see any DOM in an almost-sorta-working 3D stack of DOM elements.
// The front faces are colored for debugging, if this gist can be fixed, they can return to their normal styling.
(function () {
const MAX_ROTATION = 180;
const DEPTH_INCREMENT = 25;
const PERSPECTIVE = 1000;
const SIDE_FACE_CLASS = 'side-face';
const MAX_DOM_DEPTH = getMaxDepth(document.body);
// Calculate color based on depth, ensuring lighter colors for deeper elements
@hmmhmmhm
hmmhmmhm / avoid-in-app.js
Created August 19, 2024 05:38 — forked from vzts/avoid-in-app.js
카카오톡 인앱 브라우저 탈출하기 코드 가장 심플하게 정리 (2023.10.27 동작 확인)
const userAgent = navigator.userAgent.toLowerCase()
if (/kakaotalk/.test(userAgent)) {
location.href =
'kakaotalk://web/openExternal?url=' + encodeURIComponent(location.href)
setTimeout(() => {
location.href = /ipad|iphone|ipod/.test(userAgent)
? 'kakaoweb://closeBrowser'
: 'kakaotalk://inappbrowser/close'
})