Use command Organize Imports
Run on save - settings.json:
"editor.codeActionsOnSave": {| import { browser } from "$app/environment"; | |
| export class LocalStore<T> { | |
| value = $state<T>() as T; | |
| key = ""; | |
| constructor(key: string, value: T) { | |
| this.key = key; | |
| this.value = value; |
| #!/usr/bin/env /opt/homebrew/bin/zx | |
| const HOSTS = [ | |
| 'cdn.search.brave.com', | |
| 'cloudflare.com', | |
| 'github.com', | |
| 'dns.google', | |
| 'time.google.com', | |
| 'logseq.com', | |
| 'de.pool.ntp.org', |
| export function watchForElement<T extends Element = Element>( | |
| selector: string, | |
| callback: (element: T, observer: MutationObserver) => void, | |
| options: MutationObserverInit = { childList: true }, | |
| targetNode = document.body, | |
| ) { | |
| const observer = new MutationObserver((mutationsList) => { | |
| for (const mutation of mutationsList) { | |
| if (mutation.type === 'childList') { | |
| const element = document.querySelector<T>(selector); |
| // ==UserScript== | |
| // @name Random redirector | |
| // @namespace Violentmonkey Scripts | |
| // @match *://**/* | |
| // @grant none | |
| // @version 1.0 | |
| // @author shiftgeist | |
| // @description 12/4/2024, 3:46:35 PM | |
| // @run-at document-start | |
| // ==/UserScript== |
| // ==UserScript== | |
| // @name Hide Github pr's | |
| // @namespace shiftgeist custom Github script | |
| // @match https://github.com/*/pulls* | |
| // @icon https://github.com/fluidicon.png | |
| // @grant GM.getValue | |
| // @grant GM.setValue | |
| // @version 1.1 | |
| // @author - | |
| // @description 23/09/2024, 10:02:18 |
| // Based on https://github.com/ApoorvSaxena/lozad.js | |
| interface Options { | |
| selector: string; | |
| rootMargin: IntersectionObserverInit['rootMargin']; | |
| threshold: IntersectionObserverInit['threshold']; | |
| load(target: Element): void; | |
| loaded(target: Element): void; | |
| } |
| // ==UserScript== | |
| // @name Youtube Watch Later Quick Delete | |
| // @namespace Violentmonkey Scripts | |
| // @match https://www.youtube.com/playlist?list=WL | |
| // @icon https://www.youtube.com/favicon.ico | |
| // @grant none | |
| // @version 1.0 | |
| // @author shiftgeist | |
| // @description 29/08/2024, 14:41:36 | |
| // ==/UserScript== |
| // 1. Start on https://soundcloud.com/you/likes | |
| // 2. Scroll all the way to the bottom (may only add 300 items at a time because of soundcloud api) | |
| // (playlists are limited to 500 songs) | |
| playlistName = 'Likes' // <== your playlist | |
| list = Array.from(document.querySelectorAll('.badgeList__item .sc-button-more')) | |
| console.log('Found', list.length, 'liked songs') |
| await new Promise(resolve => setTimeout(resolve, 1000)); |