Skip to content

Instantly share code, notes, and snippets.

{
"items": [
{
"title": "Shopping websites with AMP",
"thumbnail": "amp.dev/static/samples/img/shopping_thumb.jpg",
"url": "/documentation/examples/e-commerce/product_page/preview/"
},
{
"title": "The tastiest recipes with AMP",
"thumbnail": "amp.dev/static/samples/img/recipe_thumb.jpg",
{
"name": "HackerWeb",
"short_name": "HackerWeb",
"start_url": "https://www.getkolkatanews.com/.",
"display": "standalone",
"background_color": "#fff",
"theme_color": "red",
"orientation": "portrait-primary",
"lang": "en-US",
"version": "1.1",
{
"name": "Lyrical Lyghtning",
"short_name": "LyLy",
"description": "All amp pwa code",
"start_url": "https://prasadam-code.blogspot.com/",
"background_color": "#005f99",
"theme_color": "#009987",
"display": "standalone",
"orientation": "portrait-primary",
"lang": "en-US",
{
"name": "AMP PWA CODING",
"short_name": "PRASADAM",
"description": "Get in touch. Send an email at prasadam.2012@gmail.com; Follow on fast_n_feast @twitter and BarnaliDutta-IndianCuisine @youtube for authentic Indian food and Bengali recipes.",
"start_url": "./?source=pwa",
"scope": ".",
"background_color": "#005f99",
"theme_color": "#009987",
"display": "standalone",
"orientation": "portrait-primary",
@barna2019
barna2019 / amp-web-push.service-worker.js
Created July 20, 2020 10:49
amp-web-push.service-worker.js
/**
* Copyright 2017 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@barna2019
barna2019 / amp-web-push-permission-dialog.html
Created July 20, 2020 10:46
amp-web-push-permission-dialog.html
<!doctype html>
<html>
<!-- AMP Web Push Permission Dialog -->
<head>
<meta charset="utf-8">
<!-- Do not edit styles in this section -->
<style builtin>
@barna2019
barna2019 / amp-web-push-helper-frame.html
Created July 20, 2020 10:44
amp-web-push-helper-frame.html
<!doctype html>
<html>
<!-- AMP Web Push Helper IFrame -->
<head>
<meta charset="utf-8">
<script>(function(){var f;function g(a){for(var b=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global],c=0;c<b.length;++c){var d=b[c];if(d&&d.Math==Math)return d}return function(){throw Error("Cannot find global object");}()}var h=g(this);function k(a,b){b=void 0===b?"":b;try{return decodeURIComponent(a)}catch(c){return b}};var l=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;var n=self.AMP_CONFIG||{},p=("string"==typeof n.cdnProxyRegex?new RegExp(n.cdnProxyRegex):n.cdnProxyRegex)||/^https:\/\/([a-zA-Z0-9_-]+\.)?cdn\.ampproject\.org$/;function r(a){if(self.document&&self.document.head&&(!self.location||!p.test(self.location.origin))){var b=self.document.head.querySelector('meta[name="'+a+'"]');b&&b.getAttribute("content")}}n.cdnUrl||r("runtime-host");n.geoApiUrl||r("amp-geo-api");self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:n
<!doctype html>
<html>
<head>
<title>installing service worker</title>
<script type="text/javascript">
var swsource = "https://gist.githubusercontent.com/barna2019/e9c2d4d2e1548f52b08304ef69bce2eb/raw/bcad9d0b8f938c05e3d508663d02f4dd6e196667/serviceworker.js";
if("serviceWorker" in navigator) {
navigator.serviceWorker.register(swsource).then(function(reg){
console.log('ServiceWorker scope: ', reg.scope);
}).catch(function(err) {
'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::';
@barna2019
barna2019 / amp-web-push-permission-dialog.html
Created May 16, 2020 23:42
amp-web-push-permission-dialog.html
<!doctype html>
<html>
<!-- AMP Web Push Permission Dialog -->
<head>
<meta charset="utf-8">
<!-- Do not edit styles in this section -->
<style builtin>