Skip to content

Instantly share code, notes, and snippets.

@deanhume
deanhume / clear-cache.js
Created September 20, 2017 08:22
Clear Service Worker Cache
if ('serviceWorker' in navigator) {
caches.keys().then(function(cacheNames) {
cacheNames.forEach(function(cacheName) {
caches.delete(cacheName);
});
});
}
@markhowellsmead
markhowellsmead / email_not_specific_domain.txt
Last active October 30, 2024 10:39
Regex for valid email address excluding specific free domains, like Gmail, GMX and Yahoo. Extend the list of domains according to your own requirements.
^([\w.-]+)@(\[(\d{1,3}\.){3}|(?!hotmail|gmail|googlemail|yahoo|gmx|ymail|outlook|bluewin|protonmail|t\-online|web\.|online\.|aol\.|live\.)(([a-zA-Z\d-]+\.)+))([a-zA-Z]{2,4}|\d{1,3})(\]?)$
@RiverVanRain
RiverVanRain / pagination
Created April 27, 2015 20:32
Pagination from Elgg 1.9 for Elgg 1.8
<?php
/**
* Elgg pagination
*
* @package Elgg
* @subpackage Core
*
* @uses int $vars['offset'] The offset in the list
* @uses int $vars['limit'] Number of items per page
* @uses int $vars['count'] Number of items in list