Skip to content

Instantly share code, notes, and snippets.

View fregante's full-sized avatar

fregante

View GitHub Profile
@fregante
fregante / github-open-npm.js
Created August 10, 2024 15:53 — forked from kiliman/github-open-npm.js
TamperMonkey script to open the npm package by Ctrl/Cmd+click on import statement from GitHub code view
// ==UserScript==
// @name GitHub open npm from import
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description Opens the npm package by Ctrl/Cmd+click on import statement
// @author Kiliman
// @match https://github.com/*
// @icon https://www.google.com/s2/favicons?domain=github.com
// @grant none
// ==/UserScript==
@fregante
fregante / github-open-npm.js
Created August 10, 2024 15:53 — forked from kiliman/github-open-npm.js
TamperMonkey script to open the npm package by Ctrl/Cmd+click on import statement from GitHub code view
// ==UserScript==
// @name GitHub open npm from import
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description Opens the npm package by Ctrl/Cmd+click on import statement
// @author Kiliman
// @match https://github.com/*
// @icon https://www.google.com/s2/favicons?domain=github.com
// @grant none
// ==/UserScript==
@fregante
fregante / github-open-project-fields.user.js
Last active December 9, 2023 09:00
GitHub Open project fields
// ==UserScript==
// @name GitHub Open project fields
// @version 1.0.0
// @match https://github.com/*/issues/
// @match https://github.com/*/pull/
// @run-at document-end
// ==/UserScript==
function open() {
for (const button of document.querySelectorAll('collapsible-sidebar-widget:not([open]) [aria-label^="See more fields"]')) {
@fregante
fregante / for-osx.sh
Created March 24, 2023 05:28
Delete all the workflow runs for a specific workflow in GitHub Actions (gh-cli)
# Install gh-cli https://cli.github.com
# cd to the repo folder
# Replace "ci.yml" with the workflow name you want to delete
# Run this to delete them all (500 runs at a time)
gh run list --json databaseId -q '.[].databaseId' -w ci.yml --limit 500 |
xargs -IID -P 15 gh api \
"repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/actions/runs/ID" \
-X DELETE
@fregante
fregante / devtools_page.html
Created October 22, 2022 18:46
Request permissions from devtool panel
<!DOCTYPE html>
<meta charset="utf-8" />
<script src="devtools_page.js"></script>
@fregante
fregante / background.worker.js
Last active September 30, 2022 07:09
MV3 lifetime test
// Respond to CS
const startTime = Date.now()
const delay = 13000;
chrome.runtime.onMessage.addListener( (message, sender, respond) => {
setTimeout(respond, delay, Math.round((Date.now() - startTime + delay) / 1000));
return true
})
// Overlapping fetch requests
console.log('will req');
Promise.reject(1).catch(err => {
if (err instanceof Error) {
throw err; // Exception
}
// Rejection
}).catch(exitProcess)
@fregante
fregante / README.md
Created February 9, 2017 07:47
Copy saved password bookmarklet

work-cli

Personal launcher to start working in whatever directory you're into. Customize it as needed

$ work
# tries launching GitHub.app
# tries launching Sublime Text
# tries launching the build tool (npm run watch, gulp, grump in this order)