Skip to content

Instantly share code, notes, and snippets.

View zombie's full-sized avatar

Tomislav Jovanovic zombie

View GitHub Profile
Intent to ship: userScripts extensions API
In bug 1514809, I recently enabled the new browser.userScripts
API by default for all channels. It was developed behind the
`extensions.webextensions.userScripts.enabled` pref, with most
of the work done by Luca Greco.
The feature will be in the next Firefox 68 Beta this Friday,
and reach release in July. Until more detailed documentation
is available on MDN, check out this introduction:
MORTALLY_WOUNDED = CURRENT_HEALTH <= 0
RANDOM_ENEMY_CHARACTER = RANDOM(ENEMY_CHARACTERS - MORTALLY_WOUNDED)
@zombie
zombie / gist:7759981
Last active December 30, 2015 01:59
contentScriptWhen
const tabs = require('sdk/tabs');
const { PageMod } = require('sdk/page-mod');
let s = "var x = 'start';" +
"addEventListener('DOMContentLoaded', () => x = 'ready');" +
"onload = () => x = 'end';";
let url = "data:text/html,<script>" + s + "</script> hey there";
let whens = ['start', 'ready', 'end'];
@zombie
zombie / gist:7438632
Created November 12, 2013 21:02
ES6, destructuring assignment, Error instances and JSON.stringify()
let test1 = new Error('ubik', 'testing', 123);
console.log(JSON.stringify(test1));
let test2 = { name, message, fileName, lineNumber } = test1;
console.log(JSON.stringify(test2));
@zombie
zombie / gist:3000409
Created June 27, 2012 00:17
firefox GCLI bug command
Components.utils.import("resource:///modules/devtools/gcli.jsm");
/*
* bugzilla command
* use: bug #id
*/
gcli.addCommand({
name: 'bug',
description: 'Shows a Mozilla Bugzilla bug',
params: [
{
link|pubDate|duration|title
http://www.youtube.com/watch?v=nzWOeqhiwx3&feature=g-vrec|123|123|peta
http://www.youtube.com/watch?v=zhWChAihst1&feature=g-vrec|123|123|ceta
@zombie
zombie / gist:2713980
Created May 16, 2012 21:10 — forked from anonymous/gist:2713976
z13264252
klsdfjaskl; ;laskdjf ;lasdjkfl ;sdkjf;l ksjdf
var arr = ["yea, yea", "we knew this worked"];
var [a, b] = arr;
// a == "yea, yea"
// b == "we knew this worked"
@zombie
zombie / heatmap-ajax.js
Created November 4, 2010 20:04
unobtrusive js for heatmap.mozillalabs.com
(function() {
var base='/', cache={};
$('.button').each(function one() {
var h = $(this).attr('href');
h = (h[0]!='/') ? (base+h) : (h=='/freq' ? '/freq/' : h);
if (!cache[h]) $.get(h, function(d) {
cache[h] = $(d.replace(/^[\s\S]*<body>|<scr.+ipt>/g, ''));
});
$(this).click(function() {
$('body').html(cache[h]);