Skip to content

Instantly share code, notes, and snippets.

View nmaier's full-sized avatar
😨
I may be slow to respond.

Nils Maier nmaier

😨
I may be slow to respond.
View GitHub Profile
@nmaier
nmaier / refcontrol-moz2.diff
Created December 23, 2010 07:06
Minimal patch to support Firefox 4
--- components/refcontrolComp.js Mon Jan 19 23:26:36 1970
+++ components/refcontrolComp.js Mon Jan 19 23:26:36 1970
@@ -1,7 +1,7 @@
-
-var refcontrolObserver = {
+function refcontrolObserver() {}
+refcontrolObserver.prototype = {
bEnabled: true,
aRefActions: {},
@nmaier
nmaier / override+apply-sample.js
Created January 2, 2011 18:22
Complete but untested solution incl. the signature replication
(function() {
let _old = XULBrowserWindow.setOverLink;
try {
if (Services.vc.compare(Services.appinfo.platformVersion, '2.0.*') < 0) {
// moz 2.0
XULBrowserWindow.setOverLink = function(url, anchorElt) {
try {
if (NOReferrerToNOReferrerFrom.shouldDispatchOverLink) {
NOReferrerToNOReferrerFrom.dispatchEvent("onOverLink", url);
}
// ==UserScript==
// @name Linkify Plus
// @version 2.0.2
// @namespace http://arantius.com/misc/greasemonkey/
// @description Turn plain text URLs into links. Supports http, https, ftp, email addresses.
// @include http*
// @exclude http://www.google.tld/search*
// @exclude https://encrypted.google.tld/search*
// ==/UserScript==
import os, sys
from zipfile import ZipFile, ZIP_DEFLATED
def stripdirectoryentries(source, target):
szf = ZipFile(source)
try:
if os.path.exists(target):
raise Exception("Target %s already exists" % target)
tzf = ZipFile(target, "w", ZIP_DEFLATED)
<!DOCTYPE>
<script type="text/javascript">
Object.prototype.a = "a";
Array.prototype.c = "c";
var o = {b: "b"};
for (var k in o) {
alert("obj key: " + k);
}
// expected: b
<?xml version="1.0"?>
<?xml-stylesheet href="skin.css" type="text/css"?>
<overlay id="AppTab-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript">
<![CDATA[
window.addEventListener('load', function() {
removeEventListener('load', arguments.callee, false);
function checkforAppTab() {
if (gBrowser.selectedTab.pinned) {
@nmaier
nmaier / test-ignore.user.js
Created June 8, 2011 18:48
test ignoreRedirect and redirectionLimit
// ==UserScript==
// @id test-ignore
// @name test-ignore
// @namespace tn123.org
// @include https://tn123.org/
// ==/UserScript==
GM_xmlhttpRequest({
method: "GET",
url: "https://tn123.org/somewhere",
@nmaier
nmaier / dc.html
Created June 9, 2011 19:42
Dominant FavIcon color, see dominantColor_opt; optimized processing + IMO better results on black/gray; requires chrome privs
<!DOCTYPE html>
<style type="text/css">
body {
-moz-column-count: 4;
}
</style>
<script type="text/javascript;version=1.8">
function getDominantColor(aImg) {
let canvas = document.createElement("canvas");
canvas.height = aImg.height;
@nmaier
nmaier / userscripts.org-652ff85d-1a84-456b-bd02-05136582164f@tn123.org.user.js
Created July 8, 2011 03:39
userscripts.org-652ff85d-1a84-456b-bd02-05136582164f@tn123.org
// ==UserScript==
// @id userscripts.org-652ff85d-1a84-456b-bd02-05136582164f@tn123.org
// @name Userscripts https installation
// @version 1.0
// @namespace tn123.org
// @author tn123
// @description Demonstrated GM_xpath usage
// @include http://userscripts.org/scripts/show/*
// @run-at document-end
// ==/UserScript==