Skip to content

Instantly share code, notes, and snippets.

View mgrubinger's full-sized avatar

Martin Grubinger mgrubinger

View GitHub Profile
@fubits1
fubits1 / settings-customLabels.json
Last active December 26, 2025 06:43
VSCode (and Cursor) label pattern & nesting rules for Svelte and Astro
// custom tab label patterns
// updated 2025-12-07
"workbench.editor.labelFormat": "default",
"workbench.editor.customLabels.enabled": true,
"workbench.editor.customLabels.patterns": {
"**/src/**/*.css": "${filename}",
"**/src/**/utils/**/*.{js,ts}": "${filename} ⚙️",
"**/src/**/*.d.ts": "${filename} <T>",
"**/src/**/*.{js,ts}": "${filename}",
/** SVELTE */
@fubits1
fubits1 / nixpacks.toml
Created August 16, 2025 08:50
nixpacks with nodejs_24 (Node v24.5.0)
buildImage = 'ghcr.io/railwayapp/nixpacks:latest'
[phases.setup]
nixPkgs = ["nodejs_24", "pnpm_10"]
# node v24.5.0
nixpkgsArchive = 'cf93ceb06388f5714302b702cccf2c77f6064442'
[phases.install]
dependsOn = ["setup"]
cmd = "pnpm install --frozen-lockfile"
import { build, files, version } from '$service-worker';
// https://github.com/microsoft/TypeScript/issues/11781 - this is needed for TS and ESLint
/// env serviceworker
const globalThis = /** @type {unknown} */ (self);
/// <reference no-default-lib="true"/>
/// <reference lib="es2020" />
/// <reference lib="WebWorker" />
const sw = /** @type {ServiceWorkerGlobalScope & typeof globalThis} */ (globalThis);
@paulmwatson
paulmwatson / cypress_test_404_spec.js
Created January 14, 2021 08:33
Testing a 404 page with Cypress
cy.visit('/404')
//=> Test fails
cy.visit('/404', {failOnStatusCode: false})
//=> Test passes but does not test the HTTP code was 404
cy.request({url: '/404', failOnStatusCode: false}).its('status').should('equal', 404)
cy.visit('/404', {failOnStatusCode: false})
//=> Test passes, tests that the HTTP code was 404, and tests page was visited
@srdjan
srdjan / 100+ different counter apps...
Last active August 28, 2025 18:36
100+ different js counter apps...
100+ different js counter apps...
@lilgreenland
lilgreenland / platformer (matter-js).markdown
Last active March 25, 2020 01:01
platformer (matter-js)
@xenozauros
xenozauros / hex2hsl.js
Last active January 13, 2026 22:44
Javascript: HEX to RGB to HSL
function hexToHSL(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
r = parseInt(result[1], 16);
g = parseInt(result[2], 16);
b = parseInt(result[3], 16);
r /= 255, g /= 255, b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2;
if(max == min){
h = s = 0; // achromatic
@ankurk91
ankurk91 / git_remember_password.md
Last active March 24, 2025 03:03
Git credential cache, why type password again and again

Tired of entering passwords again and again ?

Run this command to remember your password:

git config --global credential.helper 'cache --timeout 28800'

Above command will tell git to cache your password for 8 hours.

@paulirish
paulirish / what-forces-layout.md
Last active January 20, 2026 21:16
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@zeroseis
zeroseis / disable-auto-android-file-transfer.md
Created September 14, 2015 17:28
Disable auto start for Android File Transfer
  • Close Android File Transfer
  • Open Activity Monitor and kill “Android File Transfer Agent”
  • Go to where you installed “Android File Transfer.app” (I have it under /Applications)
  • Ctrl+click –> “Show package contents”
  • Go to Contents/Resources
  • Rename “Android File Transfer Agent” to e.g. “Android File Transfer Agent_DISABLED”
  • Then go to “/Users/username/Library/Application Support/Google/Android File Transfer” and again rename the Agent app.