Skip to content

Instantly share code, notes, and snippets.

Brendan Dahl brendandahl

  • Mozilla
  • San Francisco, CA
Block or report user

Report or block brendandahl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am brendandahl on github.
  • I am bdahlmoz (https://keybase.io/bdahlmoz) on keybase.
  • I have a public key ASAdMWA4LEj8U65mGa6hBg8l3BOY-j6N3a8e_bxgkvsdOAo

To claim this, I am signing this object:

@brendandahl
brendandahl / dom_load_events.js
Created May 23, 2019
Log the load events of a document.
View dom_load_events.js
const domContentLoadedPromise = new Promise(resolve => {
window.addEventListener("DOMContentLoaded", () => {
dump(">>> dialog - DOMContentLoaded event" + window.document.documentURI + "\n");
resolve();
}, { capture: true, once: true });
});
domContentLoadedPromise.then(() => {
dump(">>> dialog - Promise for domContentLoadedPromise resolved\n");
});
View analyze_xul_structure.js
let fs = require("fs");
var {
Parser
} = require("saxen");
function structure(filename) {
let contents = fs.readFileSync(filename, "utf8");
let parser = new Parser();
let indent = 0;
let out = "";
@brendandahl
brendandahl / tags.js
Last active May 10, 2019
XUL element names and HTML element namesa
View tags.js
let xulElements = ["action","arrowscrollbox","assign","bbox","binding","bindings","box","broadcaster","broadcasterset","browser","button","caption","checkbox","colorpicker","column","columns","command","commandset","conditions","content","datepicker","deck","description","dialog","dialogheader","dropmarker","editor","Findbar","grid","grippy","groupbox","hbox","iframe","image","key","keyset","label","listbox","listcell","listcol","listcols","listhead","listheader","listitem","member","menu","menubar","menuitem","menulist","menupopup","menuseparator","notification","notificationbox","observes","page","panel","param","popup","popupset","preference","preferences","prefpane","prefwindow","progressmeter","query","queryset","radio","radiogroup","resizer","richlistbox","richlistitem","row","rows","rule","scale","script","scrollbar","scrollbox","scrollcorner","separator","spacer","spinbuttons","splitter","stack","statusbar","statusbarpanel","stringbundle","stringbundleset","tab","tabbox","tabbrowser","tabpanel","tabpa
@brendandahl
brendandahl / gist:8853d78b159e939e2bbc46b1e9b7ab94
Created Apr 18, 2019
Increase number of inodes for MacOS (make git status fast again for mozilla central)
View gist:8853d78b159e939e2bbc46b1e9b7ab94
sudo sysctl kern.maxvnodes=$((512*1024))
View chrome_url_to_file_path.js
function toFile(url) { var chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry); return chromeRegistry.convertChromeURL(Services.io.newURI(url)).QueryInterface(Ci.nsIFileURL).file.path; }
@brendandahl
brendandahl / overlay_notes.md
Last active Feb 28, 2018
XUL overlay within an Overlay
View overlay_notes.md

Say there are two overlays placesOverlay.xul and macBrowserOverlay.xul and a master document aboutDialog.xul. The relationship is: aboutDialog.xul includes macBrowserOverlay.xul and macBrowserOverlay.xul includes placesOverlay.xul.

Example 1

placesOverlay.xul

<commandset id="zzz">
  <command id="zzzPlacesOverlay"/>
</commandset>
View gist:699b688fef8fc5cfd81911e6e7990bc8
./mach try -b o -p win64,linux64,macosx64 -u none -t all --rebuild-talos 6
do that with and without your commits applied, then plug the revs into this url:
https://treeherder.mozilla.org/perf.html#/compare?originalProject=try&originalRevision=a661bd8f849f75e66ab59832eb01ee5b138f6f60&newProject=try&newRevision=d32c92bd5d0e3a757d3dd00426e48a9e3c70097d&framework=1&showOnlyImportant=1
(original revision = mach try without your patch and new revision = mach try with your patch)
@brendandahl
brendandahl / scratchpad-custom-elements.diff
Last active Jan 25, 2018
Scratchpad - Replacing Overlays
View scratchpad-custom-elements.diff
index 8b9aff040b6d..ebff698f235d 100644
--- a/devtools/client/scratchpad/scratchpad.xul
+++ b/devtools/client/scratchpad/scratchpad.xul
@@ -15,7 +15,6 @@
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<?xml-stylesheet href="chrome://devtools/skin/scratchpad.css"?>
-<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<window id="main-window"
View gist:0bf46e4a1d240471348e5420d34e4028
This file has been truncated, but you can view the full file.
DEBUG:cargo::update: executing; cmd=cargo-update; args=["/home/bdahl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo", "update", "-p", "gkrust-shared", "--aggressive"]
TRACE:cargo::util::toml: read_manifest; path=/home/bdahl/projects/gecko/toolkit/library/rust/Cargo.toml; source-id=file:///home/bdahl/projects/gecko/toolkit/library/rust
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/projects/gecko/toolkit/library/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/projects/gecko/toolkit/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/projects/gecko/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/projects/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /Cargo.toml
You can’t perform that action at this time.