Skip to content

Instantly share code, notes, and snippets.

/// youtube-shorts-redirect.js
document.addEventListener('yt-navigate-finish', e => {
const pathName = window.location.pathname;
if (!/^\/shorts/.test(pathName)) return;
window.location.replace(`https://www.youtube.com/watch/?v=${pathName.match(/shorts\/(\w+)/)[1]}`);
});
twitch-videoad.js application/javascript
(function() {
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
function hookFetch() {
var OPT_ACCESS_TOKEN_PLAYER_TYPE = 'embed';//480p
//var OPT_ACCESS_TOKEN_PLAYER_TYPE = 'picture-by-picture';//360p
var realFetch = window.fetch;
window.fetch = function(url, init, ...args) {
if (typeof url === 'string') {
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
.table {
--bs-table-hover-bg: red !important;
}
async function* asyncPool(concurrency, iterable, iteratorFn) {
const executing = new Set();
async function consume() {
const [promise, value] = await Promise.race(executing);
executing.delete(promise);
return value;
}
for (const item of iterable) {
// Wrap iteratorFn() in an async fn to ensure we get a promise.
// Then expose such promise, so it's possible to later reference and
@pundoo
pundoo / twitch-selective-notification.md
Last active July 3, 2021 16:28
Twitch - Disable all channel notifications & Enable selected

// mostly useful for browser notification where you don't wanna get bombarded //

Disable

  • Goto: Settings > Notifications > Per Channel (expand until stops loading, use 'End' key for convenience)
  • Enter in console: [...document.querySelectorAll('input[type="checkbox"]')].filter((e,i)=>i>47).forEach(e => e.click()) (page might go unresponsive, don't close the tab, don't click anything else on the page, wait..)

Note: in code 47 is subject to change.

Enable