diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2020-02-07 19:44:34 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2020-02-07 19:44:34 +0530 |
commit | 8d7104f551ecc3c1277a0a0615e41e1ddf67950a (patch) | |
tree | b2ddec995b4fd523d2f18368abb1cc8a55ddff88 | |
parent | 3235c662ca4f4c33f5798bdf505a0c7726c64dd4 (diff) |
Publish deploy 2020-02-07 19:44
-rw-r--r-- | assets/serviceWorker/pwabuilder-sw-register.js | 19 | ||||
-rw-r--r-- | assets/serviceWorker/pwabuilder-sw.js | 83 | ||||
-rw-r--r-- | index.html | 2 |
3 files changed, 103 insertions, 1 deletions
diff --git a/assets/serviceWorker/pwabuilder-sw-register.js b/assets/serviceWorker/pwabuilder-sw-register.js new file mode 100644 index 0000000..cd0acf3 --- /dev/null +++ b/assets/serviceWorker/pwabuilder-sw-register.js @@ -0,0 +1,19 @@ +// This is the service worker with the Cache-first network
+
+// 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("[PWA Builder] active service worker found, no need to register");
+ } else {
+ // Register the service worker
+ navigator.serviceWorker
+ .register("pwabuilder-sw.js", {
+ scope: "./"
+ })
+ .then(function (reg) {
+ console.log("[PWA Builder] Service worker has been registered for scope: " + reg.scope);
+ });
+ }
+}
diff --git a/assets/serviceWorker/pwabuilder-sw.js b/assets/serviceWorker/pwabuilder-sw.js new file mode 100644 index 0000000..0684da5 --- /dev/null +++ b/assets/serviceWorker/pwabuilder-sw.js @@ -0,0 +1,83 @@ +// This is the service worker with the Cache-first network
+
+const CACHE = "pwabuilder-precache";
+const precacheFiles = [
+ /* Add an array of files to precache for your app */
+];
+
+self.addEventListener("install", function (event) {
+ console.log("[PWA Builder] Install Event processing");
+
+ console.log("[PWA Builder] Skip waiting on install");
+ self.skipWaiting();
+
+ event.waitUntil(
+ caches.open(CACHE).then(function (cache) {
+ console.log("[PWA Builder] Caching pages during install");
+ return cache.addAll(precacheFiles);
+ })
+ );
+});
+
+// Allow sw to control of current page
+self.addEventListener("activate", function (event) {
+ console.log("[PWA Builder] Claiming clients for current page");
+ event.waitUntil(self.clients.claim());
+});
+
+// If any fetch fails, it will look for the request in the cache and serve it from there first
+self.addEventListener("fetch", function (event) {
+ if (event.request.method !== "GET") return;
+
+ event.respondWith(
+ fromCache(event.request).then(
+ function (response) {
+ // The response was found in the cache so we responde with it and update the entry
+
+ // This is where we call the server to get the newest version of the
+ // file to use the next time we show view
+ event.waitUntil(
+ fetch(event.request).then(function (response) {
+ return updateCache(event.request, response);
+ })
+ );
+
+ return response;
+ },
+ function () {
+ // The response was not found in the cache so we look for it on the server
+ return fetch(event.request)
+ .then(function (response) {
+ // If request was success, add or update it in the cache
+ event.waitUntil(updateCache(event.request, response.clone()));
+
+ return response;
+ })
+ .catch(function (error) {
+ console.log("[PWA Builder] Network request failed and no cache." + error);
+ });
+ }
+ )
+ );
+});
+
+function fromCache(request) {
+ // Check to see if you have it in the cache
+ // Return response
+ // If not in the cache, then return
+ return caches.open(CACHE).then(function (cache) {
+ return cache.match(request).then(function (matching) {
+ if (!matching || matching.status === 404) {
+ return Promise.reject("no-match");
+ }
+
+ return matching;
+ });
+ });
+}
+
+function updateCache(request, response) {
+ return caches.open(CACHE).then(function (cache) {
+ return cache.put(request, response);
+ });
+}
@@ -1 +1 @@ -<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"/><meta name="og:site_name" content="Navan Chauhan"/><link rel="canonical" href="https://navanchauhan.github.io/"/><meta name="twitter:url" content="https://navanchauhan.github.io/"/><meta name="og:url" content="https://navanchauhan.github.io/"/><title>Hi! | Navan Chauhan</title><meta name="twitter:title" content="Hi! | Navan Chauhan"/><meta name="og:title" content="Hi! | Navan Chauhan"/><meta name="description" content="Welcome to my personal fragment of the internet."/><meta name="twitter:description" content="Welcome to my personal fragment of the internet."/><meta name="og:description" content="Welcome to my personal fragment of the internet."/><meta name="twitter:card" content="summary"/><link rel="stylesheet" href="/styles.css" type="text/css"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="shortcut icon" href="/images/favicon.png" type="image/png"/><link rel="alternate" href="/feed.rss" type="application/rss+xml" title="Subscribe to Navan Chauhan"/><meta name="twitter:image" content="https://navanchauhan.github.io/images/logo.png"/><meta name="og:image" content="https://navanchauhan.github.io/images/logo.png"/></head><head><link rel="manifest" href="manifest.json"/></head><body><header><div class="wrapper"><a class="site-name" href="/">Navan Chauhan</a><nav><ul><li><a href="/about">About Me</a></li><li><a href="/posts">Posts</a></li><li><a href="/publications">Publications</a></li><li><a href="/assets/résumé.pdf">Résumé</a></li><li><a href="https://navanchauhan.github.io/repo">Repo</a></li></ul></nav></div></header><div class="wrapper"><h1>Hi!</h1><p class="description">Welcome to my personal fragment of the internet.</p><h2>Latest content</h2><ul class="item-list"><li><article><h1><a href="/posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal">How to setup Bluetooth on a Raspberry Pi</a></h1><ul class="tag-list"><li><a href="/tags/codesnippet">code-snippet</a></li><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/raspberrypi">raspberry-pi</a></li><li><a href="/tags/linux">linux</a></li></ul><span>🕑 0 minute read. January 19, 2020</span><p>Connecting to Bluetooth Devices using terminal, tested on Raspberry Pi Zero W</p></article></li><li><article><h1><a href="/posts/2020-01-16-Image-Classifier-Using-Turicreate">Creating a Custom Image Classifier using Turicreate to detect Smoke and Fire</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/colab">colab</a></li><li><a href="/tags/turicreate">turicreate</a></li></ul><span>🕑 6 minute read. January 16, 2020</span><p>Tutorial on creating a custom Image Classifier using Turicreate and a dataset from Kaggle</p></article></li><li><article><h1><a href="/posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab">Setting up Kaggle to use with Google Colab</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/colab">colab</a></li><li><a href="/tags/turicreate">turicreate</a></li><li><a href="/tags/kaggle">kaggle</a></li></ul><span>🕑 1 minute read. January 15, 2020</span><p>Tutorial on setting up kaggle, to use with Google Colab</p></article></li><li><article><h1><a href="/posts/2020-01-14-Converting-between-PIL-NumPy">Converting between image and NumPy array</a></h1><ul class="tag-list"><li><a href="/tags/codesnippet">code-snippet</a></li><li><a href="/tags/tutorial">tutorial</a></li></ul><span>🕑 0 minute read. January 14, 2020</span><p>Short code snippet for converting between PIL image and NumPy arrays.</p></article></li><li><article><h1><a href="/posts/2019-12-22-Fake-News-Detector">Building a Fake News Detector with Turicreate</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/colab">colab</a></li><li><a href="/tags/swiftui">swiftUI</a></li><li><a href="/tags/turicreate">turicreate</a></li></ul><span>🕑 6 minute read. December 22, 2019</span><p>In this tutorial we will build a fake news detecting app from scratch, using Turicreate for the machine learning model and SwiftUI for building the app</p></article></li><li><article><h1><a href="/posts/2019-12-16-TensorFlow-Polynomial-Regression">Polynomial Regression Using TensorFlow</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/tensorflow">tensorflow</a></li><li><a href="/tags/colab">colab</a></li></ul><span>🕑 16 minute read. December 16, 2019</span><p>Polynomial regression using TensorFlow</p></article></li><li><article><h1><a href="/posts/2019-12-10-TensorFlow-Model-Prediction">Making Predictions using Image Classifier (TensorFlow)</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/tensorflow">tensorflow</a></li><li><a href="/tags/codesnippet">code-snippet</a></li></ul><span>🕑 1 minute read. December 10, 2019</span><p>Making predictions for image classification models built using TensorFlow</p></article></li><li><article><h1><a href="/posts/2019-12-08-Image-Classifier-Tensorflow">Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/tensorflow">tensorflow</a></li><li><a href="/tags/colab">colab</a></li></ul><span>🕑 4 minute read. December 8, 2019</span><p>Tutorial on creating an image classifier model using TensorFlow which detects malaria</p></article></li><li><article><h1><a href="/posts/2019-12-08-Splitting-Zips">Splitting ZIPs into Multiple Parts</a></h1><ul class="tag-list"><li><a href="/tags/codesnippet">code-snippet</a></li><li><a href="/tags/tutorial">tutorial</a></li></ul><span>🕑 0 minute read. December 8, 2019</span><p>Short code snippet for splitting zips.</p></article></li><li><article><h1><a href="/publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response">Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response</a></h1><ul class="tag-list"><li><a href="/tags/publication">publication</a></li></ul><span>🕑 1 minute read. May 14, 2019</span><p>This paper is about Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response.</p></article></li><li><article><h1><a href="/posts/hello-world">Hello World</a></h1><ul class="tag-list"><li><a href="/tags/helloworld">hello-world</a></li><li><a href="/tags/article">article</a></li></ul><span>🕑 0 minute read. April 16, 2019</span><p>My first post.</p></article></li><li><article><h1><a href="/posts/2010-01-24-experiments">Experiments</a></h1><ul class="tag-list"><li><a href="/tags/experiment">experiment</a></li></ul><span>🕑 0 minute read. January 24, 2010</span><p>Just a markdown file for all experiments related to the website</p></article></li></ul></div><script src="assets/manup.min.js"></script><script src="https://www.googletagmanager.com/gtag/js?id=UA-108635191-1v"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'UA-108635191-1');</script><footer><p>Made with ❤️ using <a href="https://github.com/johnsundell/publish">Publish</a></p><p><a href="/feed.rss">RSS feed</a></p></footer></body></html>
\ No newline at end of file +<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"/><meta name="og:site_name" content="Navan Chauhan"/><link rel="canonical" href="https://navanchauhan.github.io/"/><meta name="twitter:url" content="https://navanchauhan.github.io/"/><meta name="og:url" content="https://navanchauhan.github.io/"/><title>Hi! | Navan Chauhan</title><meta name="twitter:title" content="Hi! | Navan Chauhan"/><meta name="og:title" content="Hi! | Navan Chauhan"/><meta name="description" content="Welcome to my personal fragment of the internet."/><meta name="twitter:description" content="Welcome to my personal fragment of the internet."/><meta name="og:description" content="Welcome to my personal fragment of the internet."/><meta name="twitter:card" content="summary"/><link rel="stylesheet" href="/styles.css" type="text/css"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="shortcut icon" href="/images/favicon.png" type="image/png"/><link rel="alternate" href="/feed.rss" type="application/rss+xml" title="Subscribe to Navan Chauhan"/><meta name="twitter:image" content="https://navanchauhan.github.io/images/logo.png"/><meta name="og:image" content="https://navanchauhan.github.io/images/logo.png"/></head><head><link rel="manifest" href="manifest.json"/></head><body><header><div class="wrapper"><a class="site-name" href="/">Navan Chauhan</a><nav><ul><li><a href="/about">About Me</a></li><li><a href="/posts">Posts</a></li><li><a href="/publications">Publications</a></li><li><a href="/assets/résumé.pdf">Résumé</a></li><li><a href="https://navanchauhan.github.io/repo">Repo</a></li></ul></nav></div></header><div class="wrapper"><h1>Hi!</h1><p class="description">Welcome to my personal fragment of the internet.</p><h2>Latest content</h2><ul class="item-list"><li><article><h1><a href="/posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal">How to setup Bluetooth on a Raspberry Pi</a></h1><ul class="tag-list"><li><a href="/tags/codesnippet">code-snippet</a></li><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/raspberrypi">raspberry-pi</a></li><li><a href="/tags/linux">linux</a></li></ul><span>🕑 0 minute read. January 19, 2020</span><p>Connecting to Bluetooth Devices using terminal, tested on Raspberry Pi Zero W</p></article></li><li><article><h1><a href="/posts/2020-01-16-Image-Classifier-Using-Turicreate">Creating a Custom Image Classifier using Turicreate to detect Smoke and Fire</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/colab">colab</a></li><li><a href="/tags/turicreate">turicreate</a></li></ul><span>🕑 6 minute read. January 16, 2020</span><p>Tutorial on creating a custom Image Classifier using Turicreate and a dataset from Kaggle</p></article></li><li><article><h1><a href="/posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab">Setting up Kaggle to use with Google Colab</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/colab">colab</a></li><li><a href="/tags/turicreate">turicreate</a></li><li><a href="/tags/kaggle">kaggle</a></li></ul><span>🕑 1 minute read. January 15, 2020</span><p>Tutorial on setting up kaggle, to use with Google Colab</p></article></li><li><article><h1><a href="/posts/2020-01-14-Converting-between-PIL-NumPy">Converting between image and NumPy array</a></h1><ul class="tag-list"><li><a href="/tags/codesnippet">code-snippet</a></li><li><a href="/tags/tutorial">tutorial</a></li></ul><span>🕑 0 minute read. January 14, 2020</span><p>Short code snippet for converting between PIL image and NumPy arrays.</p></article></li><li><article><h1><a href="/posts/2019-12-22-Fake-News-Detector">Building a Fake News Detector with Turicreate</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/colab">colab</a></li><li><a href="/tags/swiftui">swiftUI</a></li><li><a href="/tags/turicreate">turicreate</a></li></ul><span>🕑 6 minute read. December 22, 2019</span><p>In this tutorial we will build a fake news detecting app from scratch, using Turicreate for the machine learning model and SwiftUI for building the app</p></article></li><li><article><h1><a href="/posts/2019-12-16-TensorFlow-Polynomial-Regression">Polynomial Regression Using TensorFlow</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/tensorflow">tensorflow</a></li><li><a href="/tags/colab">colab</a></li></ul><span>🕑 16 minute read. December 16, 2019</span><p>Polynomial regression using TensorFlow</p></article></li><li><article><h1><a href="/posts/2019-12-10-TensorFlow-Model-Prediction">Making Predictions using Image Classifier (TensorFlow)</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/tensorflow">tensorflow</a></li><li><a href="/tags/codesnippet">code-snippet</a></li></ul><span>🕑 1 minute read. December 10, 2019</span><p>Making predictions for image classification models built using TensorFlow</p></article></li><li><article><h1><a href="/posts/2019-12-08-Image-Classifier-Tensorflow">Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria</a></h1><ul class="tag-list"><li><a href="/tags/tutorial">tutorial</a></li><li><a href="/tags/tensorflow">tensorflow</a></li><li><a href="/tags/colab">colab</a></li></ul><span>🕑 4 minute read. December 8, 2019</span><p>Tutorial on creating an image classifier model using TensorFlow which detects malaria</p></article></li><li><article><h1><a href="/posts/2019-12-08-Splitting-Zips">Splitting ZIPs into Multiple Parts</a></h1><ul class="tag-list"><li><a href="/tags/codesnippet">code-snippet</a></li><li><a href="/tags/tutorial">tutorial</a></li></ul><span>🕑 0 minute read. December 8, 2019</span><p>Short code snippet for splitting zips.</p></article></li><li><article><h1><a href="/publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response">Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response</a></h1><ul class="tag-list"><li><a href="/tags/publication">publication</a></li></ul><span>🕑 1 minute read. May 14, 2019</span><p>This paper is about Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response.</p></article></li><li><article><h1><a href="/posts/hello-world">Hello World</a></h1><ul class="tag-list"><li><a href="/tags/helloworld">hello-world</a></li><li><a href="/tags/article">article</a></li></ul><span>🕑 0 minute read. April 16, 2019</span><p>My first post.</p></article></li><li><article><h1><a href="/posts/2010-01-24-experiments">Experiments</a></h1><ul class="tag-list"><li><a href="/tags/experiment">experiment</a></li></ul><span>🕑 0 minute read. January 24, 2010</span><p>Just a markdown file for all experiments related to the website</p></article></li></ul></div><script src="assets/manup.min.js"></script><script src="assets/serviceWorker/pwabuilder-sw-register.js"></script><script src="https://www.googletagmanager.com/gtag/js?id=UA-108635191-1v"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'UA-108635191-1');</script><footer><p>Made with ❤️ using <a href="https://github.com/johnsundell/publish">Publish</a></p><p><a href="/feed.rss">RSS feed</a></p></footer></body></html>
\ No newline at end of file |