Skip to content

Instantly share code, notes, and snippets.

View robinselmer's full-sized avatar

Robin Selmer robinselmer

View GitHub Profile
@robinselmer
robinselmer / jetbrains-paths.txt
Last active August 25, 2025 13:14
MacOS PHPStorm Paths
rm -rf \
"/System/Volumes/Data/Users/$(whoami)/Library/Application Support/JetBrains/"* \
"/System/Volumes/Data/Users/$(whoami)/Library/Logs/JetBrains/"* \
"/System/Volumes/Data/Users/$(whoami)/Library/Caches/JetBrains/"* \
~/Library/Application\ Support/JetBrains/* \
~/Library/Logs/JetBrains/* \
~/Library/Caches/JetBrains/*
@robinselmer
robinselmer / a11y-debug.css
Last active April 28, 2025 12:22
a11y-debug-css
img:not([alt]) {
outline: 2px dotted red;
}
@robinselmer
robinselmer / tailwind-viewport-debug.html
Last active June 18, 2025 08:47
TailwindCSS Viewport Debug
<div class="px-2 py-1 rounded text-xs font-bold text-black bg-yellow-400">
<span class="sm:hidden">NONE</span>
<span class="hidden sm:block md:hidden">SM</span>
<span class="hidden md:block lg:hidden">MD</span>
<span class="hidden lg:block xl:hidden">LG</span>
<span class="hidden xl:block 2xl:hidden">XL</span>
<span class="hidden 2xl:block">2XL</span>
</div>
<!-- See https://v3.tailwindcss.com/docs/responsive-design#using-custom-breakpoints -->
export const toggleDebugGrid = () => {
const toggleButton = document.querySelector('[data-action="toggle-debug-grid"]')
const debugGrid = document.querySelector('#debug-grid')
toggleButton.addEventListener('click', () => {
debugGrid.classList.toggle('hidden')
})
}
/**
* Creates a debounced function that delays invoking the provided function
* until after the specified time has elapsed since the last time
* the debounced function was called.
*
* @param {Function} func - The function to debounce.
* @param {number} delay - The number of milliseconds to delay.
* @returns {Function} - The debounced function.
*/
@robinselmer
robinselmer / debug.js
Last active September 19, 2024 07:46
Simple Vanilla JS logger
// Log wrapper for the console that is only enabled in dev environment
const debug = (() => {
// Check env variable
const isEnabled = process.env.NODE_ENV !== 'production'
// Pass arguments to console with same log levels
return {
log: (...args) => isEnabled && console.log(...args),
info: (...args) => isEnabled && console.info(...args),