Skip to content

Instantly share code, notes, and snippets.

View tomtev's full-sized avatar
🔷
Flatsome

Tommy Vedvik tomtev

🔷
Flatsome
View GitHub Profile
@adactio
adactio / blogServiceWorker.js
Last active March 27, 2023 09:26
A Service Worker to progressively enhance a blog by storing assets in a cache, and keeping limited caches of pages and images for offline browsing.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// A cache for core files like CSS and JavaScript
var staticCacheName = 'static';
// A cache for pages to store for offline
@westonruter
westonruter / customize-readonly.js
Last active August 9, 2016 19:23
Customize Readonly WordPress Plugin: Only let superadmins make changes in the Customizer. All other admins can just preview changes. For them, the save UI is removed/disabled, and the Ajax request to save settings is blocked. The customize_readonly filter can be used to fine-tune which users are read-only.
/*global wp, jQuery */
wp.customize.ReadOnly = ( function ( $, api ) {
var self;
self = {};
self.init = function () {
// Hide the save button
$( '#save' ).hide();