Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Ankit Ghosh kaknut

🏠
Working from home
Block or report user

Report or block kaknut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.js
//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);
});
View sw.js
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',
]);
})
);
View main.js
// 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", {
View php-limit.php
/* That’s all, stop editing! Happy blogging. */
define( 'WP_MEMORY_LIMIT', '256M' );
View font-display.css
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
font-display: swap; /* swap fonts onload */
src: url("...");
}
View prefetch.html
<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 Jun 5, 2019 — forked from anonymous/houses.csv
Tables in Medium
View houses.csv
house leader seat
Stark Jon Snow Winterfell
c Cersei Lannister Kings Landing
Targaryen Daenerys Targaryen Dragonstone
Greyjoy Pyke Euron Greyjoy
View demo.csv
house leader seat
Stark Jon Snow Winterfell
Lannister Cersei Lannister Kings Landing
Targaryen Daenerys Targaryen Dragonstone
Greyjoy Pyke Euron Greyjo
You can’t perform that action at this time.