const z = await navigator.serviceWorker.getRegistrations() // return array Of [ServiceWorkerRegistration]
/***
[{
active: ServiceWorker {scriptURL: "http://localhost:5000/service-worker.js", state: "activated", onerror: null, onstatechange: ƒ}
installing: null
navigationPreload: NavigationPreloadManager {}
onupdatefound: ƒ ()
paymentManager: PaymentManager {instruments: PaymentInstruments, userHint: ""}
- CRA
- Firebase (Note: Messaging) when i was young
- Goto (https://console.firebase.google.com/u/0/project/PROJECT_ID/settings/cloudmessaging)
- in
Cloud MessagingSettings generatekey pair in Web Push Certificates - create
push-notification.jswherever you want.
import firebase from 'firebase/app'
This file contains hidden or 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
| #!/bin/bash | |
| # create Dockerfile | |
| # make sure this script run in your app directory | |
| # I'm use node v8.12.0 (you can change) | |
| cat <<EOF > Dockerfile | |
| FROM node:8.12.0 as buildx | |
| WORKDIR /usr/src/app | |
| COPY package.json yarn.lock ./ |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Downlod File</title>
<script>
function downloadBlob(data, filename) {
const responseData = window.URL.createObjectURL(new Blob([data]));
Just command for forgotten wifi password
security find-generic-password -ga "ROUTERNAME" | grep "password:"
- cra-project/public/index.html
<% for ( var css in htmlWebpackPlugin.files.css ) { %>
<link rel="preload" as="style" href="<%=htmlWebpackPlugin.files.css[css]%>" as="style" onload='this.rel="stylesheet"'>
<% } %>
<% for ( var js in htmlWebpackPlugin.files.js ) { %>
<link rel="preload" as="script" href="<%=htmlWebpackPlugin.files.js[js] %>" as="script">
<% } %>
# test on Mac Mojave
# this command for stuck GPG Verify
gpgconf --kill gpg-agent
This file contains hidden or 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
| # gcloud auth activate-service-account --key-file=85.json | |
| # gcloud projects list | |
| project="my-projet" | |
| space="" | |
| echo "gcloud auth list" | |
| gcloud auth list | |
| echo -e "$space" |
- create setupTests.js in src/setupTests.js (automatically CRA read setupTest.js)
// setupTests.js
import React from "react";
import Adapter from "enzyme-adapter-react-16";
import Enzyme, { configure, shallow, mount, render } from "enzyme";
import { createSerializer } from "enzyme-to-json";
import sinon from "sinon";
expect.addSnapshotSerializer(createSerializer({ mode: "deep" }));
- Setup Basic
$ git config --global user.name "name"
$ git config --global user.email "email"
- Installation
# mac
$ brew install gpg
# brew install gpg2