Skip to content

Instantly share code, notes, and snippets.

# 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
let foo = 1;
let bar = 2;
let obj = { foo, bar };
obj.foo // 1
obj.bar // 2
@n1snt
n1snt / Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md
Last active April 26, 2024 20:02
Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

var smc = new SourceMapConsumer(theSourceMapJSON);
var smg = SourceMapGenerator.fromSourceMap(smc);
smc.sources.forEach(function (s) {
smg.setSourceContent(s, somehowGetTheSourceContentsOf(s));
});
// This is your modified map.
smg.toJSON();
@fitzgen
fitzgen / gist:95f8b2ea672d773f3537
Created August 2, 2014 22:12
Generators + prototypes
function* G() { yield this.x; }
G.prototype = { x: 5 };
console.log([...G()]);
@floxay
floxay / get_client_version.py
Last active April 26, 2024 20:01
Get VALORANT client/build version from game executable
import pefile
def get_product_version(data: bytes) -> str:
pe = pefile.PE(data=data, fast_load=True)
pe.parse_data_directories(
directories=[pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_RESOURCE"]]
)
for file_info in pe.FileInfo:
for entry in file_info:
Cu.import("resource://gre/modules/Task.jsm")
let runTaskWhileValid = (isValid, generator) => {
Task.spawn(function* () {
const g = generator();
let value, resolved;
let done = false;
while (!done) {
try {
({ value, done }) = g.next(resolved);