Skip to content

Instantly share code, notes, and snippets.


Jan T. Sott idleberg

View GitHub Profile
ryansolid / framework size
Last active October 22, 2022 13:27
Size Comparison Vue vs Svelte vs Solid
View framework size

Based on Evan You's methodology:


Vue Vue (SSR) Svelte Svelte (SSR) Solid Solid (SSR)
Source 3.93kb - 3.31kb - 4.98kb -
Compiled w/o imports (min) 2.73kb - 5.01kb (183.52%) 6.59kb (241.39%) 3.68kb (134.805) 3.96kb (145.05%)
Compiled w/o imports (min+gz) 1.25kb - 2.13kb (170.40%) 2.68kb (214.40%) 1.46kb (116.80%) 1.57kb (125.60%)
Compiled w/o imports (min+brotli) 1.10kb - 1.88kb (170.91%) 2.33kb (211.82%) 1.26kb (114.55%) 1.32kb (120.00%)
DashBarkHuss / background.js
Created July 20, 2021 22:33
Sample Chrome Extension Message Passing Background to Content Script Manifest V3
View background.js
try {
// This is the background script for the extension
// A listener for when the user clicks on the extension button
// chrome.action.onClicked.addListener(buttonClicked);
// Handle that click
function buttonClicked(tab) {
sindresorhus /
Last active February 4, 2023 12:50
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
mislav / gh-rename-master
Last active April 24, 2022 10:02
Rename the default branch of a repository using GitHub CLI
View gh-rename-master
# Usage: gh-rename-master <newbranch> [<remote>]
# Renames the "master" branch of the current repository both locally and on GitHub.
# dependencies: GitHub CLI v0.10
set -e
View little-vdom.js
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key})
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=>
// arrays,p)=>render(e,d,t.o&&t.o[p])):
// components{children:e.c},e.p),e.s=t.s||{},t=>
// create notes
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)),
// diff props
zadr / steps.txt
Last active August 10, 2022 19:31
MacPorts install without root privileges
View steps.txt
# fetch MacPorts sources
curl -LO
# extract them and get into the dir
tar -jxf MacPorts-2.4.1.tar.gz
cd MacPorts-2.4.1
# configure things
## If you want MacPorts to run in a custom prefix, pass in the following arguments: --prefix=/usr/local --with-unsupported-prefix --with-applications-dir=/Applications
./configure --with-no-root-privileges --with-install-user=$USER --with-install-group=staff --silent
LeeBergstrand / Linuxbrew_Config.yml
Last active September 29, 2021 09:20
CircleCi config for homebrew
View Linuxbrew_Config.yml
version: 2
working_directory: ~/repo
machine: true
- checkout
jherax / is-private-mode.js
Last active December 14, 2022 15:09
Detect if the browser is running in Private mode - Promise based (last update: Feb 2020)
View is-private-mode.js
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
* Live demo:
* @see
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see
petemcw /
Last active October 22, 2020 21:24
Mac OS X Docker Instructions using Dinghy

Docker Installation

A great way to get Docker running smoothly on OS X is to use the awesome project Dinghy. It is basically:

Docker on OS X with batteries included, aimed at making a more pleasant local development experience. Runs on top of docker-machine.

Some of the benefits are:

  • Faster volume sharing using NFS rather than built-in virtualbox/vmware file shares
  • Filesystem events work on mounted volumes
Tusko / functions.php
Last active February 27, 2022 13:46
WP Ajax search (ACF included)
View functions.php
/* Wordpress Custom Search by title, ACF, post_meta */
// Wordpress ?s= redirect to /search/
function wpa_search_redirect() {
global $wp_rewrite;
if (!isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->using_permalinks()) { return; }
$search_base = $wp_rewrite->search_base;
if (is_search() && !is_admin() && strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false) {
wp_redirect(home_url("/{$search_base}/" . urlencode(get_query_var('s'))));