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
| exports.add = function (x, y) { | |
| return x + y; | |
| } | |
| exports.sub = function (x, y) { | |
| return x - y; | |
| } | |
| exports.sumOfPositiveNumbers = function (upperLimitInclusive) { | |
| let result = 0; |
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
| using System.Security.Claims; | |
| using System.Text.Encodings.Web; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Authentication; | |
| using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.AspNetCore.Builder; | |
| using Microsoft.AspNetCore.Hosting; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.Extensions.DependencyInjection; | |
| using Microsoft.Extensions.Hosting; |
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
| using System; | |
| using System.Threading.Tasks; | |
| var tcs = new TaskCompletionSource(); | |
| var sigintReceived = false; | |
| Console.WriteLine("Waiting for SIGINT/SIGTERM"); | |
| Console.CancelKeyPress += (_, ea) => | |
| { |
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
| FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env | |
| WORKDIR /app | |
| # Copy csproj and restore as distinct layers | |
| COPY *.csproj ./ | |
| RUN dotnet restore | |
| # Copy everything else and build | |
| COPY . ./ | |
| RUN dotnet publish -o out |
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
| using Microsoft.Extensions.DependencyInjection; | |
| using Microsoft.Extensions.Hosting; | |
| using System; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| var host = new HostBuilder() | |
| .ConfigureServices((hostContext, services) => services.AddHostedService<ShutdownService>()) | |
| .UseConsoleLifetime() | |
| .Build(); |
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
| var heroes = new Hero[] { | |
| new("Homelander", "DC", true), | |
| new("Jessica Jones", "Marvel", false), | |
| }; | |
| class Hero { | |
| public Hero(string name, string universe, bool canFly) => | |
| (Name, Universe, CanFly) = (name, universe, canFly); | |
| public string Name { get; } |
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
| package main | |
| import ( | |
| "fmt" | |
| "strings" | |
| ) | |
| // Generic iterator function type | |
| type iteratorFunc[T any] func() *T; |
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
| using static System.Console; | |
| // We can simply replace == with is. Doesn't make much sense, though. | |
| int someNumber = 42; | |
| if (someNumber is 42) WriteLine("Some number is 42"); | |
| // Situation changes when we change the type to object. | |
| object something = 42; | |
| // The following statement would not work (you cannot use == with |
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
| exports.add = function (x, y) { | |
| return x + y; | |
| } | |
| exports.sub = function (x, y) { | |
| return x - y; | |
| } | |
| exports.sumOfPositiveNumbers = function (upperLimitInclusive) { | |
| let result = 0; |
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
| import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http"; | |
| import { NgModule } from "@angular/core"; | |
| import { FormsModule } from "@angular/forms"; | |
| import { BrowserModule } from "@angular/platform-browser"; | |
| import { | |
| MsalInterceptor, | |
| MsalModule, | |
| MsalService, | |
| MSAL_INSTANCE, | |
| MSAL_INTERCEPTOR_CONFIG, |
OlderNewer