Skip to content

Instantly share code, notes, and snippets.

trumad / addElementHelperFunction.js
Last active Mar 22, 2021
A javascript helper function to add elements to the DOM
View addElementHelperFunction.js
// Helper function to create new DOM elements, by thanael -
function addEl() {
function isElement(element) { // Check if something is a DOM element
// This function from
return element instanceof Element || element instanceof HTMLDocument;
// Defaults, if the user specifies nothing:
let el = document.body; // add our new element to the document.body by default
let tag = "div"; // add a DIV element by default
let attr = {}; // no attributes by default
trumad /
Last active May 6, 2022
See multiple tradingview windows side by side, hopefully without ads and popups.
# First install webview:
# pip install pywebview
# Then create a config.json file in the same folder with the following options:
trumad / grabPatreonVids
Created Sep 15, 2020
How to grab videos from patreon posts en masse.
View grabPatreonVids
//Enter the following commands in a browser console.
// First, set up a way to click on stuff. just using .click() doesn't seem to work for some reason.
var clickEvent = new MouseEvent("click", {
"view": window,
"bubbles": true,
"cancelable": false
// Then load up all the posts. You'll probably need to click "load" a few times to see all of them.
trumad / claim all twitch prime games
Last active May 26, 2021
Run this in the browser console to claim all available twitch prime games.
View claim all twitch prime games
var buttons = document.querySelectorAll("div[data-a-target=tw-core-button-label-text]")
for (var i=0,j = buttons.length;i<j;i++){
if (buttons[i].textContent.includes("Claim Offer")||buttons[i].textContent.includes("Claim Game")){