made with esnextbin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//First, check if service worker is supported or not | |
if ("serviceWorker" in navigator) { | |
navigator.serviceWorker.register("./serviceWorker.js", {scope: "./"}) //Passing serviceWorker file and scope | |
.then(function (event) { | |
console.log("Service Worker is registered ", event); | |
}) | |
.catch(function (error) { | |
console.error("Service Worker is failed to register ", error); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"always_show_minimap_viewport": true, | |
"auto_complete": true, | |
"bold_folder_labels": false, | |
"caret_extra_width": 2, | |
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme", | |
"folder_exclude_patterns": | |
[ | |
".svn", | |
".git", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function singlyLinkedList() { | |
this.length = 0; //Default value | |
this.head = null; | |
} | |
//To store in a new node | |
function storeNode(data) { | |
this.data = data; | |
this.next = null; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Activate event will be triggered once after registering, also used to clean up caches | |
self.addEventListener("activate", function (event) { | |
var cacheWhitelist = ['my-static-files']; | |
event.waitUntil( | |
caches.keys() | |
.then(function (allCaches) { | |
//Check all caches and delete old caches here | |
allCaches.map(function (cacheName) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//After install, fetch event is triggered for every page request | |
self.addEventListener("fetch", function (event) { | |
console.log("Request -->", event.request.url); | |
//To tell browser to evaluate the result of event | |
event.respondWith( | |
caches.match(event.request) //To match current request with cached request it | |
.then(function(response) { | |
//If response found return it, else fetch again. | |
return response || fetch(event.request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Cache polyfil to support cacheAPI in browsers | |
importScripts('/cache-polyfill.js'); | |
//Cache name | |
var staticCache = "my-static-files"; | |
//Files to cache | |
var filesToCache = [ | |
"/", | |
"images/logo.jpg", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
(function() { | |
// Update 'version' if you need to refresh the cache | |
var staticCacheName = 'static'; | |
var version = 'v1::'; |
Align an element horizontally & vertically center using css.
A Pen by Gokulakrishnan Kalaikovan on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"*": | |
welcome: | |
showOnStartup: false | |
core: | |
themes: [ | |
"atom-dark-ui" | |
"one-dark-syntax" | |
] | |
editor: | |
invisibles: {} |