This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Match all comments | |
\n?\s*\/\/\s.* | |
# \n? optional-linebreak for matching comments on their own line | |
# \s* matches any number of spaces preceeding // | |
# \/\/ matches // | |
# \s matches a single space after //. Lack of a space may indicate non-comment usage of // | |
# .* matches the content of the comment until the end of the current line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// Isolate Event Listener so it is safe to use | |
// current URL is checked each time the event listener is activated | |
// if a different page is loaded, the event will destroy itself the next time it is active | |
// In this demo, we are able to completely isolate this behavior inside | |
// an abstraction called createIsolatedEvent, which is fully reusable | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sites-chrome-everything { | |
background: #f9fbfc; | |
} | |
#sites-header-title { | |
height: 80px; | |
} | |
#sites-chrome-page-wrapper-inside #sites-chrome-header-wrapper { | |
background: none; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove Twitter Promoted Tweets | |
window.addEventListener('scroll', _event => { | |
[ ...document.querySelectorAll('h2') ] | |
.filter(heading => heading.textContent.includes("Promoted Tweet")) | |
.map(heading => heading.parentElement.parentElement) | |
.forEach(promotion => promotion.remove()) | |
}) | |
// Remove LinkedIn Promoted Posts | |
window.addEventListener('scroll', _event => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CorePub is a SPA, so as we paginate through their feeds, our page doesn't reload. | |
// In the console, enter | |
const links = [] | |
// Navigate through each page in the feed. Each time, enter the following in the console | |
links.push( | |
...Array.from(document.querySelectorAll('.mobile-teaser-link'), link => link.href) | |
) | |
// Once you've collected all of the links from the feed, sort and copy the results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const matchesCaseInsensitive = (first, ...rest) => { | |
if (rest.length === 0) { | |
throw new Error(`Expected at least 2 arguments`) | |
} | |
const target = first.toLowerCase() | |
return rest.every(value => value.toLowerCase() === target) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var scriptOrder = 0 | |
function loadScript (src) { | |
// create script | |
var script = document.createElement("script") | |
script.async = true | |
script.src = src | |
// insert script into the top of the document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Array.prototype.contains: https://esdiscuss.org/topic/having-a-non-enumerable-array-prototype-contains-may-not-be-web-compatible | |
// Array.prototype.flatten: https://developers.google.com/web/updates/2018/03/smooshgate | |
// String.prototype.contains: https://bugzilla.mozilla.org/show_bug.cgi?id=1102219 | |
// globalThis: https://github.com/tc39/proposal-global/blob/master/NAMING.md | |
Array.prototype.all = Array.prototype.every | |
Array.prototype.any = Array.prototype.some | |
Array.prototype.contains = Array.prototype.includes | |
Array.prototype.flatten = Array.prototype.flat |