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
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 September 29, 2025 14:24
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

{
@DamianEdwards
DamianEdwards / DotNetCore-New.md
Last active November 25, 2018 20:25
Proposal for .NET Core CLI "new" command

.NET Core CLI: new

The new command is used to create new .NET Core projects. Projects are created using templates installed via NuGet packages.

Templates are laid out in their NuGet packages in a hierarchical fashion that enables the creation of simple trees of templates with categories that are then merged across the installed template packages to create an overall template tree. This tree allows the display of an interactive menu when creating new projects, while also allowing for direct project creation using a template node's full path, e.g. dotnet new -t aspnetcore/mvc/empty

As templates are in normal NuGet packages and installed into the standard NuGet packages folder, they can depend on other NuGet

using System.Threading.Tasks;
using Microsoft.AspNet.Razor.TagHelpers;
namespace WebApplication1.TagHelpers
{
[HtmlTargetElement("raw")]
public class RawTagHelper : TagHelper
{
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
@DamianEdwards
DamianEdwards / Parts.md
Created November 14, 2015 22:03
Old desktop PC parts for sale

Some parts I no longer need after my recent dekstop rebuild. Make me an offer. Buyer pays for postage. Will sell individually or as a whole. All working to my best knowledge, but SOLD AS-IS.

  • GIGABYTE NVIDIA GeForce GTS 250 GV-N250ZL-1GI 1GB 256-Bit GDDR3 PCI Express 2.0 x16
  • GIGABYTE GA-EX58-UD4P Motherboard w/ Intel Core i7 920
    • Includes original Intel CPU fan & motherboard original accessories including SATA cables & SLI adapters
  • G.SKILL RIPJAWS DDR3-1600 PC3-12800 24GB 6x4GB CL9-9-9-24 1.5v
  • Thermolab Baram CPU cooler w/ fan clips for one side
@DamianEdwards
DamianEdwards / ApplicationStartup.cs
Last active October 13, 2015 05:38
ASP.NET 5 ApplicationStartup base class
using System;
using Microsoft.AspNet.Builder;
using Microsoft.Dnx.Runtime;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNet.Hosting
{
/// <summary>
@DamianEdwards
DamianEdwards / Program.cs
Created October 4, 2015 06:55
Quick test of system timer frequency vs. Environment.TickCount in .NET
using System;
namespace ConsoleApp3
{
public class Program
{
public void Main(string[] args)
{
var length = TimeSpan.FromSeconds(2);
var started = DateTime.UtcNow;