Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am empyrical on github.
  • I am empyrical (https://keybase.io/empyrical) on keybase.
  • I have a public key ASCJTiVkRyulY40ApMTH6Shx8dLu95IsXnvxD4fG100LsQo

To claim this, I am signing this object:

@empyrical
empyrical / decorator.py
Created October 28, 2015 03:20
PyQt5 annotation-based slot decorator
# Functions for the Qt meta-object system (like signal, slot, etc)
from inspect import getfullargspec
from PyQt5.QtCore import pyqtSlot
class _OverloadedSlotPlaceholder:
def __init__(self, name, original_name):
self.name = name
self.original_name = original_name
@empyrical
empyrical / README.md
Created July 16, 2015 04:28
Firefox addons: A monkey-patchable CommonJS environment

Firefox addons: A monkey-patchable CommonJS environment

This solution was written for JPM 1.0.0.

It is also a proof-of-concept, and has not been thoroughly tested yet. Use at your own risk!

The Firefox module loader, by default, has all modules live in their own isolated world and don't share any global object. You can't monkey-patch default methods/the global object in one module of your extension, and have it be affected in another module of your extension.

Mozilla's JPM tool handily lets you use packages straight from NPM in your Firefox add-on, but the globals in the JS environment in an extension's main process are pretty barebones until you require anything. Globals that tons of NPM modules take for granted as being available - like setTimeout, XMLHttpRequest, even variables pointing to the global object like global or window arent there.