Skip to content

Instantly share code, notes, and snippets.

View JonasBa's full-sized avatar
💭
Listening to 50c rn

Jonas JonasBa

💭
Listening to 50c rn
View GitHub Profile
const table = document.querySelector(
"#dashboard > div.ContentWrapper.ContentWrapper-normal.Infrastructure > div > div > div > div.col-md-3 > section > div.stl-table-wrapper.stl-rounded.stl-text-grey-900.stl-bg-white.stl-typo-display-body > table"
);
const items = Array.from(table.querySelectorAll("tr"));
items.map(row => {
if(row.textContent.includes('Latency')) return
const country = row.querySelector("span:nth-child(2)").textContent.trim();
const latency = row
.querySelector(".region-response-time")
@JonasBa
JonasBa / gist:71d1cf01a221146c8c2d3ab449f162df
Last active December 17, 2021 09:08
URL sentry console test
function dsntoString(dsn, withPassword) {
const { host, port, path, pass, projectId, protocol, publicKey } = dsn;
return (
`${protocol}//${publicKey}${withPassword && pass ? `:${pass}` : ''}` +
`@${host}${port ? `:${port}` : ''}${path}/${projectId}`
);
}
function dsnFromString(str) {
const url = new URL(str);
@JonasBa
JonasBa / gist:f14a9034c10e21bcd61f5f95770a66aa
Created April 20, 2022 15:19
git blame from eslint output
/* eslint-env node */
// This a typescript file, so you need to run it with something that can compile it like ts-node,
// or you can just compile it yourself with tsc. The output of the script is logged to stdout.
//
// the workflow is to run "eslint > out.txt && ts-node blame.ts"
// right now, the script only picks up the author email and commit sha where the lint error
// was introduced - a possible improvement is to query gh's api to get the username of the person.
import {execSync} from 'child_process';
import fs from 'fs';
@JonasBa
JonasBa / gist:eba2215bbf4a5a42b27486d6268639fd
Created October 4, 2023 17:54
Mark gh merged and closed PRs
// ==UserScript==
// @name gh notifications
// @namespace http://tampermonkey.net/
// @version 0.1
// @description mark githup notifications
// @author You
// @match https://github.com/notifications?query=is%3Aunread
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
@JonasBa
JonasBa / gist:90a9ed25f11a6c186ec3e9905afeee9c
Created February 25, 2024 14:54
LoAF scripts attribution test
// go to chrome://flags/ and enable Experimental Web Platform features flag
// Add a logger for LoAF entries
const observer = new PerformanceObserver(function(list) {
for (const entry of list.getEntries()) { console.log(entry) }
});
observer.observe({type: "long-animation-frame", buffered: true});
// Define a slow and fast function. The slow function here is the precise source of our performance bottleneck
HTML
<div class="bar" data-background="10px 10px">
<div class="child"></div>
</div>
<div class="bar second">
<div class="child"></div>
</div>
CSS
.bar {