Skip to content

Instantly share code, notes, and snippets.

View Hth4nh's full-sized avatar
👨‍💻
Coding

Thành Hoàng Trần Hth4nh

👨‍💻
Coding
View GitHub Profile
function waitForElement(selector, { signal } = {}) {
const root = this instanceof Element ? this : document;
const element = root.querySelector(selector);
if (element) return Promise.resolve(element);
return new Promise((resolve, reject) => {
const observer = new MutationObserver(() => {
const element = root.querySelector(selector);
if (element) {
observer.disconnect();
@Hth4nh
Hth4nh / style.css
Last active July 6, 2024 17:25
Dark mode for LeetCode's homepage
body,
html,
#footer-root *,
.content-wrapper {
background-color: #1a1a1a !important;
color: #d7d7d7;
border: 0 solid;
}
#leetcode-navbar {
@Hth4nh
Hth4nh / CrxDownload.js
Created November 16, 2023 08:22
Download .crx file from Chrome WebStore (or directly install, i'm not sure)
// Triple-click the 4th line, then drag & drop it to your bookmark bar
javascript:(()=>{const a=location.pathname.match(/(?<=\/)[a-z]{32}(?=\/|$)(?!\/+[a-z]{32}(?=\/|$))/)?.[0];a&&location.assign("https://clients2.google.com/service/update2/crx?response=redirect&prodversion=9999.0.9999.0&acceptformat=crx2,crx3&x=id%253D"+a+"%2526uc")})()
// Triple-click 4th line, then drag & drop to your bookmark bar