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
const mergeSort = (unsortedArray) => { | |
// Check if the length is lower or equal to 1, otherwise return input. | |
// This is also our break condition for the recursion | |
if (unsortedArray.length <= 1) { | |
return unsortedArray; | |
} | |
// Split input array in two equally parts when possible. | |
// The half of the length could possibly be an floating number 3 / 2 = 1.5, | |
// so we use Math.floor to get an whole number by remove the decimal part. |
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
[Authorize] | |
public async Task Logout() | |
{ | |
await HttpContext.SignOutAsync("Auth0", new AuthenticationProperties | |
{ | |
RedirectUri = "https://patrickschadler.com" | |
}); | |
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); | |
} |
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 IActionResult Login(string returnUrl = “/”) | |
{ | |
await HttpContext.ChallengeAsync(“Auth0”, new AuthenticationProperties() { RedirectUri = returnUrl }); | |
} |
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 void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
... | |
app.UseAuthentication(); | |
... | |
} |
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 void ConfigureServices(IServiceCollection services) | |
{ | |
// Add authentication services | |
services.AddAuthentication(options => { | |
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; | |
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; | |
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme; | |
}) | |
.AddCookie() | |
.AddOpenIdConnect("Auth0", options => { |
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
namespace MyApp.Services.Handler | |
{ | |
public class JsonExceptionMiddleware | |
{ | |
private readonly IHostingEnvironment _environment; | |
private const string DefaultErrorMessage = "A server error occurred."; | |
public JsonExceptionMiddleware(IHostingEnvironment environment) | |
{ | |
_environment = environment; |
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
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text; | |
using FluentAssertions; | |
using LinkReader.Installer; | |
using LinkReader.Reader; | |
using LinkReader.Retriever; | |
using LinkReader.Retriever.Interfaces; |
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
<div style="text-align:center"> | |
<h1> | |
Welcome to {{ title }}! | |
</h1> | |
<label >Parent Component Input: </label> | |
<input type="text" [(ngModel)]="textInput"> | |
<p>Child Value is: {{childValue}}</p> | |
<app-child [parentInput]="textInput" (childOutput)="updatedChildValue($event)"></app-child> | |
</div> |
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
<p>Parent Input is: {{parentInput}} </p> | |
<label >Child Component Input: </label> | |
<input type="text" [ngModel]="childTextValue" (ngModelChange)="updateOutput($event)"> |