Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kaknut's full-sized avatar
:bowtie:
Hustle Bustle

Ankit Ghosh kaknut

:bowtie:
Hustle Bustle
View GitHub Profile
//Add this below content to your HTML page, or add the js file to your page at the very top to register service worker
if (navigator.serviceWorker.controller) {
console.log('active service worker found, no need to register')
} else {
//Register the ServiceWorker
navigator.serviceWorker.register('/service-worker.js', {
scope: './'
}).then(function(reg) {
console.log('Service worker has been registered for scope:'+ reg.scope);
});
self.addEventListener('install', function(event){
event.waitUntil(
caches.open('NutPanda-cache-v10').then(function(cache){
return cache.addAll([ // add the links to assests you want to cache
'https://demo.com/main.css',
'https://example.co/min.css',
]);
})
);
// Add this below content to your HTML page, or add the js file to your page at the very top to register service worker
// Check compatibility for the browser we're running this in
if ("serviceWorker" in navigator) {
if (navigator.serviceWorker.controller) {
console.log("NutPanda: active service worker found, no need to register");
} else {
// Register the service worker
navigator.serviceWorker
.register("sw.js", {
/* That’s all, stop editing! Happy blogging. */
define( 'WP_MEMORY_LIMIT', '256M' );
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
font-display: swap; /* swap fonts onload */
src: url("...");
}
<link rel="dns-prefetch" href="//example.com"> //prefetch dns of domain which will be soon needed.
<link rel="prefetch" href="//example.com/demo.html"> //prefecth whole page or assets which the user woould most probably move next.
<link rel="preload" href="//example.com/demo.html"> //preload whole page or assets which will be required in same page
@kaknut
kaknut / houses.csv
Last active June 5, 2019 06:17 — forked from anonymous/houses.csv
Tables in Medium
house leader seat
Stark Jon Snow Winterfell
c Cersei Lannister Kings Landing
Targaryen Daenerys Targaryen Dragonstone
Greyjoy Pyke Euron Greyjoy
house leader seat
Stark Jon Snow Winterfell
Lannister Cersei Lannister Kings Landing
Targaryen Daenerys Targaryen Dragonstone
Greyjoy Pyke Euron Greyjo