- Install Docker Desktop
Because we already have an official CockroachDB docker image, we will use that in our docker-compose.yml
file. We recommend you use one of the current tags instead of latest
.
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(LongestSubstringWithKUniqueChars("abcba", 2)); | |
} | |
private static string LongestSubstringWithKUniqueChars(string s, int k) | |
{ | |
if (k == 0) |
@supports (padding-top: constant(safe-area-inset-top)) { | |
body { | |
padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); | |
} | |
} | |
@media (display-mode: fullscreen) { | |
body { | |
padding: 0; | |
} |
import React from 'react'; | |
import ProgressiveImage from 'react-progressive-graceful-image'; | |
import styled from 'styled-components'; | |
const PlcHolder = styled.img` | |
background: linear-gradient( | |
to right, | |
rgb(246, 247, 248) 0%, | |
rgb(237, 238, 241) 20%, | |
rgb(246, 247, 248) 40%, |
// 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', () => { |
Because we already have an official CockroachDB docker image, we will use that in our docker-compose.yml
file. We recommend you use one of the current tags instead of latest
.
# 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 | |
}); |
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 |
import * as React from 'react'; | |
import Nav from './Nav.jsx'; | |
import { Router } from './routing'; | |
const routes = new Map<string, React.ComponentType>([ | |
['/', () => <p>Pick an Ipsum!</p>], | |
['/lorem', React.lazy(() => import('./pages/Lorem'))], | |
['/bacon', React.lazy(() => import('./pages/Bacon'))], | |
['/hipster', React.lazy(() => import('./pages/Hipster'))], | |
['/office', React.lazy(() => import('./pages/Office'))], |
import * as React from 'react'; | |
const Lorem = React.lazy(() => import('./pages/Lorem')); | |
const App = () => ( | |
<React.Suspense fallback={<div className="loading-spinner" />}> | |
<Lorem /> | |
</React.Suspense> | |
); |