Skip to content

Instantly share code, notes, and snippets.

View achou11's full-sized avatar
🐝
(╯'□')╯︵ ┻━┻

Andrew Chou achou11

🐝
(╯'□')╯︵ ┻━┻
View GitHub Profile
@achou11
achou11 / electron-net-module-bug-in-utility-process.md
Last active August 19, 2025 13:12
Electron `net` module bug in utility process

When calling net.isOnline() (and presumably, net.online) within utility process, the result is always true and does not reflect the actual online state of the host device.

Link to reported issue: electron/electron#48100

@achou11
achou11 / viewport-meta.js
Last active November 13, 2023 18:24
Add a <meta> html tag to make sites more usable on mobile devices: https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag
// Call this function
function addViewportMeta() {
const head = document.head
if (!head.querySelector('meta[name=viewport]')) {
const meta = document.createElement('meta')
meta.setAttribute("name", "viewport")
meta.setAttribute("content", "width=device-width, initial-scale=1")
head.appendChild(meta)
}
}
@achou11
achou11 / clean-twitter-links.js
Created September 11, 2021 07:08
Replace embedded links in Tweets with their true URL
@achou11
achou11 / remove-twitter-topics.js
Last active August 11, 2021 14:35
JS snippet to remove Twitter's suggestion topics on web
function findParentArticle(node) {
if (node.nodeName === 'ARTICLE') return node
return findParentArticle(node.parentNode)
}
function removeTopics(debug = false) {
let numberRemoved = 0
const topics = document.querySelectorAll('[aria-label^="Follow Topic"]')
if (topics.length === 0) return
const isPangram = test => {
const alphabetSet = new Set('abcdefghijklmnopqrstuvwxyz')
const testSet = new Set(test.replace(/[^a-z]/gi, '').toLowerCase())
return testSet.size === alphabetSet.size
}
console.log(isPangram("This is NOT a pangram.")) // false
console.log(isPangram("The QUICK brown fox jumps over the LAZY dog.")) // true
@achou11
achou11 / keybase.md
Created January 4, 2018 04:54
Keybase Proof for Github

Keybase proof

I hereby claim:

  • I am achou11 on github.
  • I am andrew_chou (https://keybase.io/andrew_chou) on keybase.
  • I have a public key ASAhTEL5pBk9gJcuevVRlOOoJEkbISeS2E_tx9vgzd6MkAo

To claim this, I am signing this object: