Skip to content

Instantly share code, notes, and snippets.

@richstokoe
richstokoe / Startup.SecureSpa.cs
Last active August 28, 2018 09:35
Securing AspNetCore SPA Template
using Microsoft.AspNetCore.Authentication;
// Configure()
app.Use(async (context, next) =>
{
if (!context.User.Identity.IsAuthenticated)
{
await context.ChallengeAsync();
}
using System.IO;
using System.Text;
using Microsoft.Azure.Cosmos;
using Newtonsoft.Json;
namespace Application1
{
public class CosmosJsonNetSerializer : CosmosSerializer
{
private static readonly Encoding DefaultEncoding = new UTF8Encoding(false, true);
@richstokoe
richstokoe / webcomponent-switchable-shadowdom.js
Created December 29, 2020 17:23
WebComponent showing simple consumer switching between shadow vs non-shadow DOM
// Encapsulated
// <my-webcomponent shadow></my-webcomponent>
// Inherits page styles
// <my-webcomponent></my-webcomponent>
class MyWebComponent extends HTMLElement {
constructor() {
let self = super();