I hereby claim:
- I am arash16 on github.
- I am arash16 (https://keybase.io/arash16) on keybase.
- I have a public key whose fingerprint is B513 AC6B 61D1 1F45 93C8 8FE6 AE79 A9BA 3518 BC72
To claim this, I am signing this object:
[ | |
{ | |
"id": 1, | |
"name": "0 \u0631\u0633\u06cc\u062f\u06af\u06cc \u0628\u0647 \u062a\u062e\u0644\u0641", | |
"children": [ | |
{ | |
"id": 3, | |
"name": "\u0627\u0637\u0644\u0627\u0639\u0627\u062a \u062a\u0648\u0636\u06cc\u062d\u06cc \u06af\u0645\u0631\u0627\u0647\u200c\u06a9\u0646\u0646\u062f\u0647 ", | |
"description": "\ufeff\u0648\u062c\u0648\u062f \u0627\u0637\u0644\u0627\u0639\u0627\u062a \u06af\u0645\u0631\u0627\u0647\u200c\u06a9\u0646\u0646\u062f\u0647 \u0648 \u063a\u06cc\u0631 \u0648\u0627\u0642\u0639\u06cc \u062f\u0631 \u0627\u0637\u0644\u0627\u0639\u0627\u062a \u062a\u0648\u0636\u06cc\u062d\u06cc \u0628\u0631\u0646\u0627\u0645\u0647: \n\u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0647\u0627 \u0646\u0628\u0627\u06cc\u062f \u062f\u0627\u0631\u0627\u06cc \u0627\u0637\u0644\u0627\u0639\u0627\u062a\u06cc \u063a\u0644\u0637 \u0648 \u06af\u0645\u0631\u0627\u0647\u200c\u06a9\u0646\u0646\u062f\u0647 \u062f\u0631 \u0645\u062d\u062a\u0648\u0627\u |
// this code is executed in the context of each tab | |
import {Workbox} from 'workbox-window'; | |
if ('serviceWorker' in navigator) { | |
const wb = new Workbox('/sw.js'); | |
wb.addEventListener('waiting', () => { | |
console.log('A new service worker has installed'); | |
wb.addEventListener('controlling', () => { |
# this is a minimal sample code used for ci pipelines to implement blue/green deployment |
// Simplified Sample Code for limiting nuxt ssr per user | |
const { RateLimiterMemory } = require("rate-limiter-flexible"); | |
const { cpuFree } = require('os-utils'); | |
// each user has 1SSR per minute | |
const ipRateLimiter = new RateLimiterMemory({ | |
points: 1, // 1 SSR | |
duration: 60, // Per minute | |
}); |
const cache = {}; | |
export function makePlaceholder(width, height) { | |
const key = `${width}x${height}`; | |
if (!cache[key]) { | |
cache[key] = 'data:image/svg+xml;base64,' + window.btoa( | |
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}"> | |
<rect width="${width}" height="${height}" fill="#f0f0f0"/> | |
</svg>` | |
); | |
} |
export default function asyncDataWrapper(originalAsyncData) { | |
return async function(ctx) { | |
try { | |
return await originalAsyncData.call(this, ctx); | |
} | |
catch (e) { | |
// statusCode=1 is connectivity error (assigned inside API-Layer) | |
if (process.client && e.statusCode === 1) { | |
window.addEventListener('online', () => { | |
// reload the page when connection is back |
I hereby claim:
To claim this, I am signing this object: