Skip to content

Instantly share code, notes, and snippets.

Remove Duplicate Svelte Classes (Loader)

Svelte has an open issue because of a "feature" that adds duplicate classses which breaks the expected cascade in favor of some inexplicable specificity. Instead of having to go through all your override/modifier rules and add !important to them, you can just add this WP plugin to strip out the duplicate classes.

// in ./.webpack/loader.remove-duplicate-svelte-classes.js

module.exports = function removeDuplicateSvelteClasses(source) {
  const SVELTE_RULE_REGEX = /\.svelte-[a-z0-9]+/g;
  const ruleMatches = (source.match(SVELTE_RULE_REGEX) || []);
@the0neWhoKnocks
the0neWhoKnocks / Codemods.md
Last active November 17, 2021 20:48
codemods

Codemods


Write a CodeMod

This example swaps out function name with another

source.js

console.log('this should be a warning');
@the0neWhoKnocks
the0neWhoKnocks / Bash Scripting.md
Last active March 29, 2023 09:50
Bash Scripting

Bash Scripting


Shebang

#!/usr/bin/env bash
@the0neWhoKnocks
the0neWhoKnocks / Google Search Tips.md
Last active December 8, 2022 02:19
Google Search Tips

Google Search Tips


Exact Search

Wrap your search in double quotes

Limit Search by Domain

Prefix your search with site:

@the0neWhoKnocks
the0neWhoKnocks / Self Hosted Git Server.md
Last active October 4, 2021 20:31
Self Hosted Git Server

Self Hosted Git Server


Install on Portainer

  • Couldn't figure out how to use mounts with gogs (there was an odd mix of permissions being used), so you'll have to create some volumes instead.
    • Volumes > Add Volume (x2)
      Name: gogs-backup
      Name: gogs-data
      
@the0neWhoKnocks
the0neWhoKnocks / Arch Linux.md
Last active May 7, 2023 13:20
Arch Linux Install and Customization

Arch Linux Install and Customization


Live env. (booting Linux from a separate drive)

I use Ventoy to store multiple Linux imgs on one drive, with the ability to choose from a menu any distro I want.

At the time of writing, I used ventoy v1.0.52, and Arch Linux v2021.09.01.

Service Worker Notes


  • If you cache files during the installation phase, bandwidth and CPU will be shared while the cache is being filled since duplicate requests will go out for the assets being cached. Generally you'd want to wait for an event to be dispatched after the key parts of your App are loaded, then start caching files.
  • A general guideline for data storage is that URL addressable resources should be stored with the Cache interface, and other data should be stored with IndexedDB. For example HTML, CSS, and JS files should be stored in the cache, while JSON data should be stored in IndexedDB. Note that this is only a guideline, not a firm rule.
@the0neWhoKnocks
the0neWhoKnocks / Jenkins Groovy Notes.md
Created June 10, 2021 23:55
Jenkins / Groovy notes

Jenkins & Groovy Notes


Run a command in another Executor

sh 'echo "some text" >> "$WORKSPACE/file.log"'
// the file will end up in a second workspace, not the main one.