Skip to content

Instantly share code, notes, and snippets.

@strarsis
strarsis / service-workers.md
Created February 11, 2025 22:08 — forked from Rich-Harris/service-workers.md
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@strarsis
strarsis / git-overwrite-branch.sh
Created August 15, 2024 21:12 — forked from ummahusla/git-overwrite-branch.sh
Git overwrite branch with another branch
# overwrite master with contents of feature branch (feature > master)
git checkout feature # source name
git merge -s ours master # target name
git checkout master # target name
git merge feature # source name
@strarsis
strarsis / Directory_Prompts_WT_Uninstall.reg
Created June 24, 2024 10:52 — forked from OmegaRogue/Directory_Prompts_WT_Uninstall.reg
Registry script to add windows terminal with cmd, powershell and ubuntu profiles to the explorer context menu with normal and admin permissions. To use, replace <Username> with your username
Windows Registry Editor Version 5.00
; Windows terminal
[-HKEY_CLASSES_ROOT\Directory\shell\MenuWindowsTerminal]
[-HKEY_CLASSES_ROOT\Directory\background\shell\MenuWindowsTerminal]
[-HKEY_CLASSES_ROOT\Directory\LibraryFolder\shell\MenuWindowsTerminal]
@strarsis
strarsis / chainfilters-test.svg
Created September 23, 2023 21:41
Firefox chainFilters test SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@strarsis
strarsis / functions.php
Created April 13, 2023 14:06 — forked from yanknudtskov/functions.php
Example on how to meta query ACF repeater fields
<?php
add_shortcode( 'user_company_link', 'yanco_user_company_link' );
function yanco_user_company_link() {
if( ! is_user_logged_in() ) {
return;
}
$html = '';
@strarsis
strarsis / shape.svg
Last active October 27, 2022 19:38
shape.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@strarsis
strarsis / wave-1-mask-border-i.svg
Last active May 17, 2022 19:08
Wave 1 Mask border
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@strarsis
strarsis / initial-l.svg
Created May 17, 2022 17:22
Initials mask
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@strarsis
strarsis / gist:b989ac83b4c1cb11927820627fb6079a
Created March 31, 2022 20:58
WordPress Activity Log Plugin error after update
[Unknown column 'client_ip' in 'field list']
REPLACE INTO `wp_wsal_occurrences` (`site_id`, `alert_id`, `created_on`, `client_ip`, `severity`, `object`, `event_type`, `user_agent`, `user_roles`, `username`, `user_id`, `session_id`, `post_status`, `post_type`, `post_id`) VALUES (1, 2101, '1648760092.973838', '', '', '', '', '', '', NULL, NULL, '', '', '', 0)
@strarsis
strarsis / log
Created March 24, 2022 20:25
WooCommerce Update Thank You page white screen/PHP error
PHP message: WordPress database error Unknown column 'is_read' in 'field list' for query UPDATE `wp_wc_admin_notes` SET `name` = 'wc-admin-optimizing-the-checkout-flow', `type` = 'info', `locale` = 'en_US', `title` = 'Optimizing the checkout flow', `content` = 'It’s crucial to get your store’s checkout as smooth as possible to avoid losing sales. Let’s take a look at how you can optimize the checkout experience for your shoppers.', `content_data` = '{}', `status` = 'pending', `source` = 'woocommerce.com', `date_created` = '2021-02-03 19:00:04', `date_reminder` = NULL, `is_snoozable` = '0', `layout` = 'plain', `image` = '', `is_deleted` = '', `is_read` = '' WHERE `note_id` = '41' made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('[...]/wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, Automattic\WooCommerce\Admin\Install::check_version, do_actio...PH