Skip to content

Instantly share code, notes, and snippets.

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

<hmmhmmhm/> hmmhmmhm

๐Ÿงฏ
BURNING!!
View GitHub Profile
@joshuacerbito
joshuacerbito / useScroll.js
Last active January 8, 2024 13:44
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);
@Rich-Harris
Rich-Harris / README.md
Last active December 20, 2019 15:19
Optimising CSS modules

WICG/webcomponents#759

Suppose you have an app like this, and your bundler turns .css files into strings:

// main.js
import './x-foo.js';
import './x-bar.js';

document.body.innerHTML = ``;
@Rich-Harris
Rich-Harris / README.md
Last active December 20, 2019 15:19
Source bytes: React vs Ember Octane vs Svelte

I'm procrastinating instead of working on a conference talk, so I decided to implement this component in Svelte to see which framework is most expressive:

Screen Shot 2019-03-30 at 16 42 16

Ember Octane

Here's the original, with the addition of an import for dataUriAsSrc (and updated per @chriskrycho's comment):

<img
@Rich-Harris
Rich-Harris / README.md
Last active September 21, 2024 22:39
Svelte vs Knockout
@Zezombye
Zezombye / owo.txt
Last active July 22, 2023 09:05
Overwatch custom game icon list
This glitch has returned with team names: https://i.imgur.com/vVaQvH9.png
Patched on 1.48 though.
All credit goes to flarn2006, he was the one who found that glitch!
!!!!
New album, way better organized
ALL sprays, player icons, achievement icons, and other stuff!
https://imgur.com/a/HJoeHy1
/**
* Converts an ArrayBuffer to a String.
*
* @param buffer - Buffer to convert.
* @returns String.
*/
export default function arrayBufferToString(buffer: ArrayBuffer): string {
return String.fromCharCode.apply(null, Array.from(new Uint16Array(buffer)));
}
@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 / 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')