Skip to content

Instantly share code, notes, and snippets.

View llimos's full-sized avatar

Shimon Lyons llimos

View GitHub Profile
@llimos
llimos / gist:ee818bcb3060adc8469f4978c654a184
Created August 5, 2020 08:17
Firefox bookmarklet for HN discussion of current page
javascript:(()=>{const w=window.open();fetch(`https://hn.algolia.com/api/v1/search?tags=story&query=${encodeURIComponent(window.location.href)}`).then(a => a.json()).then(a=>{const c=a.hits.filter(b=>b.url===window.location.href)[0];if(c){w.location.replace(`https://news.ycombinator.com/item?id=${c.objectID}`)}else{w.confirm('Not on HN. Submit?') ? w.location.replace(`https://news.ycombinator.com/submitlink?u=${encodeURIComponent(document.location)}&t=${encodeURIComponent(document.title)}`):w.close();}})})()