Skip to content

Instantly share code, notes, and snippets.

View jiacai2050's full-sized avatar
:shipit:

Jiacai Liu jiacai2050

:shipit:
View GitHub Profile
@jiacai2050
jiacai2050 / tree.md
Created February 28, 2016 15:10 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

const { Cc, Ci } = require("chrome");
const xpcom = require("xpcom");
const { Class } = require("api-utils/heritage");
exports.preventCrossRequest = Class({
extends: xpcom.Unknown,
interfaces: ["nsIContentPolicy"],
shouldLoad: function (contType, contLoc, reqOrig, ctx, typeGuess, extra) {