Skip to content

Instantly share code, notes, and snippets.

let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
function openToolbox() {
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.showToolbox(target, "jsdebugger");
}
function closeToolbox() {
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.closeToolbox(target);
function* asyncIterator() {
let value, done;
while ({value, done} = (yield null), !done) {
console.log("got", value);
}
console.log("done");
}
it = asyncIterator();
it.next();
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 26, 2024 20:04
Complete Recent Discord Quest

Complete Recent Discord Quest

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
  2. Join a vc
  3. Stream any window (can be notepad or something)
  4. Press Ctrl+Shift+I to open DevTools
  5. Go to the Console tab
  6. Paste the following code and hit enter:
let wpRequire;
Cu.import("resource://gre/modules/jsdebugger.jsm");
addDebuggerToGlobal(this);
let browser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
let contentWindow = browser.contentWindow;
let dbg = new Debugger(contentWindow);
let start = Date.now();
dbg.memory.captureDominatorTree(contentWindow)
"use strict";
var immut = (function () {
var descriptor = {
value: null
};
return function immut() {
if (arguments.length % 2 !== 0)
@concavelenz
concavelenz / original.ts
Created July 30, 2021 18:18
zone + async
async function myCode() {
const value = await doSomething();
const value2 = await somethingElse(value)
return value2 + 1;
}
# Proposed Format
{
...
7. sources: ["baz.ts", "foo.js", "bar.js"]
...
9. mediaTypes: ["application/javascript", "application/x.typescript"],
10. sourcesMediaTypes: "CAA",
}
diff --git a/browser/devtools/debugger/test/head.js b/browser/devtools/debugger/test/head.js
index 1c97620..5dd4070 100644
--- a/browser/devtools/debugger/test/head.js
+++ b/browser/devtools/debugger/test/head.js
@@ -734,17 +734,24 @@ function closeDebuggerAndFinish(aPanel, aFlags = {}) {
"unless you're absolutely sure about what you're doing.");
}
return teardown(aPanel, aFlags).then(finish);
}
var d = Object.create(Date.prototype);
Date.call(d);
d instanceof Date // true
d.getTime() // throws an Error!
@arshednabeel
arshednabeel / vicsek.py
Last active April 26, 2024 20:02
A minimal implementation of the Vicsek model in ~50 lines of code
import numpy as np
from tqdm import trange
def get_neighbour_matrix(x, L, R):
dx = np.subtract.outer(x[:, 0], x[:, 0])
dy = np.subtract.outer(x[:, 1], x[:, 1])
dx[dx > (L / 2) ** 2] -= (L / 2) ** 2
dy[dy > (L / 2) ** 2] -= (L / 2) ** 2
pair_dist = dx ** 2 + dy ** 2