Skip to content

Instantly share code, notes, and snippets.

@a-stankevich
Created February 5, 2019 06:33
Show Gist options
  • Save a-stankevich/453f3f241f47eb0a913ab247e342acaa to your computer and use it in GitHub Desktop.
Save a-stankevich/453f3f241f47eb0a913ab247e342acaa to your computer and use it in GitHub Desktop.
Highligh hackernews comments
// use this to filter out relevant comments in huge HN threads
// open a post with jobs in comments, e.g. https://news.ycombinator.com/item?id=18807017
// open browser developer console (F12 or Alt-Cmd-C usually works)
// paste code of these functions:
function showComments(keywords) {
[].filter.call(document.getElementsByClassName('comment'), c => keywords.every(kw => c.innerText.toLowerCase().includes(kw.toLowerCase()))).forEach(c => c.classList.remove('noshow'))
}
function hideAll() {
[].forEach.call(document.getElementsByClassName('comment'), c => c.classList.add('noshow'))
}
function showAll() {
[].forEach.call(document.getElementsByClassName('comment'), c => c.classList.remove('noshow'))
}
// then use code like this to highlight comments
hideAll()
showComments(['remote', '.net'])
showComments(['remote', 'python'])
showComments(['ruby', 'javascript'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment