This file contains 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
if (_configuration == null && Options.ConfigurationManager != null) | |
{ | |
_configuration = await Options.ConfigurationManager.GetConfigurationAsync(Context.RequestAborted); | |
} |
This file contains 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
[TestMethod] | |
public async Task Collapser_WithMultipleExecutions_OnlyRunsOnce() | |
{ | |
int i = 0; | |
var collapser = new Collapser<int>(TimeSpan.FromMilliseconds(100)); | |
Func<CancellationToken, Task<int>> action = (ct) => { i++; return Task.FromResult(i); }; | |
await collapser.ExecuteAsync(action, default); | |
await collapser.ExecuteAsync(action, default); | |
await collapser.ExecuteAsync(action, default); |
This file contains 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
public class Collapser<TResult> | |
{ | |
private SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); | |
private long windowInTicks; | |
private long nextRun; | |
private TResult lastResult; | |
public Collapser(TimeSpan window) | |
{ | |
this.windowInTicks = window.Ticks; |
This file contains 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
FROM node:12-alpine | |
WORKDIR /app | |
COPY package.json yarn.lock ./ | |
RUN yarn install | |
COPY . . | |
CMD ["node", "/app/src/index.js"] |
This file contains 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
FROM node:12-alpine | |
WORKDIR /app | |
COPY . . | |
RUN yarn install | |
CMD ["node", "/app/src/index.js"] |
This file contains 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
<template> | |
<div id="app"> | |
<input | |
v-on:focus="$event.target.select()" | |
ref="myinput" | |
readonly | |
:value="text"/> | |
<button @click="copy">Copy</button> | |
</div> | |
</template> |
This file contains 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
public class Time | |
{ | |
private int seconds; | |
private Time(int seconds) | |
{ | |
this.seconds = seconds; | |
} | |
public static Time Hours(int n) |
This file contains 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
{ | |
"openapi": "3.0.1", | |
"info": { | |
"title": "PetStore API", | |
"version": "v1" | |
}, | |
"paths": { | |
"/api/PetStore": { | |
"get": { | |
"tags": [ |
This file contains 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
code --install-extension christian-kohler.npm-intellisense | |
code --install-extension christian-kohler.path-intellisense | |
code --install-extension CoenraadS.bracket-pair-colorizer-2 | |
code --install-extension dbaeumer.vscode-eslint | |
code --install-extension eamodio.gitlens | |
code --install-extension esbenp.prettier-vscode | |
code --install-extension leizongmin.node-module-intellisense | |
code --install-extension ms-azuretools.vscode-azureterraform | |
code --install-extension ms-vscode.azure-account | |
code --install-extension ms-vscode.azurecli |
This file contains 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
code --install-extension christian-kohler.npm-intellisensecode --install-extension christian-kohler.path-intellisense | |
code --install-extension CoenraadS.bracket-pair-colorizer-2 | |
code --install-extension dbaeumer.vscode-eslint | |
code --install-extension eamodio.gitlens | |
code --install-extension esbenp.prettier-vscode | |
code --install-extension leizongmin.node-module-intellisense | |
code --install-extension ms-azuretools.vscode-azureterraform | |
code --install-extension ms-vscode.azure-account | |
code --install-extension ms-vscode.azurecli | |
code --install-extension ms-vscode.csharp |