Skip to content

Instantly share code, notes, and snippets.

Working from home

Ed Charbeneau EdCharbeneau

Working from home
View GitHub Profile
View BearerScheme.cs
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
Description =
"JWT Authorization header using the Bearer scheme. \r\n\r\n Enter 'Bearer' [space] and then your token in the text input below.\r\n\r\nExample: \"Bearer 12345abcdef\"",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey,
Scheme = "Bearer"
EdCharbeneau / RemoteAuthenticatorView.razor
Created Jun 4, 2020
All the RemoteAuthenticatorView templates
View RemoteAuthenticatorView.razor
<RemoteAuthenticatorView Action="@Action">
<span>Logging you in...</span>
<span>Checking permissions...</span>
<span>Sorry, your login failed. Please try again or contact support.</span>
View How to use Razor Components with

A tip sent to me by Brian Douglass...

The way it works is:

  • Create a new Server project with Identity activated, but no scaffolding
  • Modify Startup.cs to add the AF token as a header
  • Create a custom SignIn.razor
    • Collects credentials in a form
    • OnValidSubmit() after checking validity of credentials
      • Make Http call to Login.OnGet() and get the form, with the AF token attached
      • Build new request with Credentials + AF token in the Form data + AF token in the header.
EdCharbeneau / ExampleMetadata.cs
Last active May 3, 2020
Create a menu from Application components.
View ExampleMetadata.cs
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
public static class ExampleMetadata
public static IEnumerable<MenuItem> GetItems()
View foo.ts
export MyClass {
private foo: string = "hello";
public addHandler() {
window.addEventListener("resize", this.logResize);
public logResize() {
console.log(this); // Expected: MyClass | Actual: Window
View gist:60380828b71593f100cbfa040bebe890
Ed is a Microsoft MVP and an international speaker, writer, online influencer, a Developer Advocate for Progress - [Telerik UI for Blazor](, and expert on all things web development. Ed enjoys geeking out to cool new tech, brainstorming about future technology, and admiring great design.
View Index.razor.cs
void HandleTabChange(TabEventArgs args)
var value = (Foo)args.Value;
if (value.Id == 1)
args.Cancel = true;
SelectedItem = value;
View AlertBox.razor
<div class="alert alert-danger">
@code {
[Parameter] public RenderFragment ChildContent { get; set; }
EdCharbeneau /
Created Nov 20, 2019
But I'm an independent contractor.

Today I went to the lumber yard to get some tools and materials. I explained to the manager that I was building a deck for a neighbor and I needed supplies. I explained that I'm an independent contractor and I would like all of the tools and materials for free since I'm really not making a huge profit yet, and I'm only a small one person business. The manager said I could borrow some tools for 30 days, but had to buy them at the end of the trial period. He wasn't flexible on pricing for lumber either, I guess he just doesn't care about the small contractor AT ALL! I think I can get some pallets from the recycling center, enough to get started and move on to the next project. Maybe when I get ready for my next job these big companies will finally care about the little guy. Running a small independent contracting business is so difficult these days because of this.

View SpaLoader.razor
@if (IsLoading)
@code {
You can’t perform that action at this time.