Skip to content

Instantly share code, notes, and snippets.

@BrockA
BrockA / checkForBadJavascripts.js
Created May 6, 2012 06:11
This is a utility function, meant to be used inside a Greasemonkey script that has the "@run-at document-start" directive set. It Checks for and deletes or replaces specific <script> tags.
/*--- checkForBadJavascripts()
This is a utility function, meant to be used inside a Greasemonkey script that
has the "@run-at document-start" directive set.
It Checks for and deletes or replaces specific <script> tags.
*/
function checkForBadJavascripts (controlArray) {
/*--- Note that this is a self-initializing function. The controlArray
parameter is only active for the FIRST call. After that, it is an
event listener.
#!/usr/bin/env python
# Linux usage: ./extract_tampermonkey_script.py "/home/<USER>/.config/<BROWSER>/Default/Local Extension Settings/<EXTENSION_ID>"
# i.e.: ./extract_tampermonkey_script.py "/home/foo/.config/google-chrome-beta/Default/Local Extension Settings/gcalenpjmijncebpfijmoaglllgpjagf"
# Mac usage: ./extract_tampermonkey_script.py "/Users/<USER>/Library/Application Support/Google/Chrome/Default/Local Extension Settings/<EXTENSION_ID>/"
# i.e.: ./extract_tampermonkey_script.py "/Users/foo/Library/Application Support/Google/Chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo/"
import leveldb
import sys
import re
@BrockA
BrockA / waitForKeyElements.js
Created May 7, 2012 04:21
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@BrockA
BrockA / checkForBadJavascripts_Demo.user.js
Created May 6, 2012 06:50
This demonstrates the checkForBadJavascripts function in a complete Greasemonkey script and against a target page (http://jsbin.com/ogudon).
// ==UserScript==
// @name _Replace evil Javascript
// @include http://jsbin.com/ogudon*
// @run-at document-start
// ==/UserScript==
/****** New "init" function that we will use
instead of the old, bad "init" function.
*/
function init () {
@BrockA
BrockA / Add_kbd_shortcut.user.js
Last active February 12, 2017 22:00
This is a userscript that adds shortcuts for adding <kbd> tags to posts. Designed for Stack Exchange sites.
// ==UserScript==
// @name OBSOLETE: StackExchange, Add kbd shortcut
// @description Adds a button and a keyboard shortcut (Alt-K) to add <kbd> tags.
// @version 1.3
// @match *://*.askubuntu.com/*
// @match *://*.onstartups.com/*
// @match *://*.serverfault.com/*
// @match *://*.stackapps.com/*
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*
@BrockA
BrockA / hatoverflow.user.js
Last active December 14, 2015 04:51
Stack Exchange, Winterbash, Hat Overflow
// ==UserScript==
// @name Stack Exchange, Winterbash, Hat Overflow
// @description Adds how many Winterbash hats each user has, into the "signature blocks" of posts.
// @match *://*.askubuntu.com/*
// @match *://*.mathoverflow.net/*
// @match *://*.onstartups.com/*
// @match *://*.serverfault.com/*
// @match *://*.stackapps.com/*
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*