Skip to content

Instantly share code, notes, and snippets.

View DamianEdwards's full-sized avatar
🏠
Working from home

Damian Edwards DamianEdwards

🏠
Working from home
View GitHub Profile
@DamianEdwards
DamianEdwards / ComponentTagHelper.cs
Created September 5, 2019 22:49
ComponentTagHelper
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace SampleTagHelpers
{
[HtmlTargetElement("component")]
@DamianEdwards
DamianEdwards / app.csproj
Created July 3, 2019 19:40
.NET Core daily build feeds
<Project>
<PropertyGroup>
<!-- .NET Core daily build feeds, put this in your project's csproj or solution Directory.Build.props -->
<RestoreSources>
$(RestoreSources);
https://api.nuget.org/v3/index.json;
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json;
https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json;
https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json;
@DamianEdwards
DamianEdwards / Script.md
Last active June 14, 2017 08:52
NDC Oslo 2017 - What's new in ASP.NET Core 2.0
  1. File new Razor Pages project
  2. Open Program.cs and talk about WebHost.CreateDefaultBuilder
  3. Show configuration & logging WebHostBuilder APIs
  4. Open Startup.cs
  5. Show IConfiguration is now injected 'cos it's in DI
  6. Show that all the configuration logger setup is gone 'cos it's defaulted by WebHOst.CreateDefaultBuilder
  7. Add authentication for Twitter & Google
  8. Show that all the APIs are now available by default because of the new Microsoft.AspNetCore.All meta-package
  9. Open the CSPROJ and show how simple it is with just the single package
  10. Talk about the new runtime store that ensures all the packages aren't deployed with the application
@DamianEdwards
DamianEdwards / Program.cs
Created March 27, 2017 17:55
Simpler ASP.NET Core startup?
using System;
using System.Task;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace HelloWorld
{
public class Program
@DamianEdwards
DamianEdwards / SignalRCore.md
Last active January 18, 2017 15:49
NDC London SignalR Core
  • Still very early days so much of this could change
  • Architecture diagram: Sockets vs. SignalR
  • SignalR Core new features
    • non-HTTP
    • Binary support
    • Endpoint API & formatters
    • Custom protocols
    • No-jQuery dependency (works in Web Workers & Node.JS now)
    • Pure WebSocket client
  • Get results from client invocations
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WebApplication21.Data;
using WebApplication21.Models;
namespace WebApplication21.Controllers
{
@DamianEdwards
DamianEdwards / Startup.cs
Last active June 21, 2016 22:28
Ideas for patterns for URL Rewrite middleware
public class Startup
{
public void Configure()
{
// Raw HTTP->HTTPS redirect using MapWhen
app.MapWhen(
context => context.Request.Scheme == "http",
map => map.Run(context =>
{
// NOTE: Should also handle non-default HTTPS port if required
@DamianEdwards
DamianEdwards / project1.json
Created February 26, 2016 18:39
Package names
{
"compilationOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": ["wwwroot", "Views"]
@DamianEdwards
DamianEdwards / json-in-markdown.md
Last active May 8, 2025 21:06
JSON comments on GH

What happens if you tell GitHub it's JSON

{
  "hello": "world" // I want my comments!
}

Use jsonc as the language instead

{