Skip to content

Instantly share code, notes, and snippets.

@markrendle
markrendle / PS1.sh
Created September 4, 2017 20:32
Git Prompt
export PS1='\n[\e[0;32m\u@\h\e[m \e[1;33m\w\e[m\e[0;31m$(__git_ps1 " (%s)")\e[m]\n\$ '
@markrendle
markrendle / bio.md
Created April 4, 2017 20:12
Mark's Bio for conferences and such

Mark is the founder and CTO of RendleLabs, a software development consulting company. He works with new and emerging technologies, and shares his experience with teams and organisations looking to adopt those technologies for their projects. Currently Mark specializes in .NET Core and helps teams get up to speed with the wider ecosystem opened up by this cross-platform version of .NET; things like Linux, Docker, microservice architectures and so on. Mark also contributes to various open source projects, and speaks at conferences and user groups around the world. He is a Microsoft Azure MVP and a Docker Captain. In his spare time, he enjoys gaming, watching movies, and putting off writing his (probably best-selling) book.

@markrendle
markrendle / abstract.md
Created February 2, 2017 23:07
.NET Core, The Universe, and Everything

.NET Core, The Universe and Everything

.NET Core finally brings a fully-supported, open-source version of the framework cross-platform, and with the 2.0 release due in Spring, it's really ready for prime-time. While C# and .NET are familiar, the new ecosystem in which whey find themselves is bigger and more open than ever before, and the design and architecture of the systems you can build is very different from the "ASP.NET hosted in IIS" model you're used to.

Join Mark as he shares some of what he's learned from working with ASP.NET Core since the very first preview release of Project K through to version 1.1, including:

@markrendle
markrendle / Pilates.md
Last active December 19, 2016 16:42
The 9 Arbitrary Rules Of Object Pilates

Object Pilates outlines 9 completely arbitrary and hopelessly unrealistic rules to apply when performing the exercise:

  • One primitive parameter per method.
  • Don't use the subtract operator.
  • Wrap all increment operations in static methods.
  • Singly-linked lists.
  • One underscore per file.
  • Don't loop.
  • Keep all solutions less than 529 lines.
  • No methods with more than two callers.

Thoughts on project files

I missed last night's ASP.NET Community Standup on account of being shattered after a long day and falling asleep. Then I checked Twitter on the train this morning and discovered that the .NET world had, apparently, been burned to the ground by marauding Microsofties (again). It seemed to have something to do with project files, JSON vs XML, and suchlike.

Finally, lunchtime happened and I could watch the recording of the standup, and I got to understand what everyone was on about. In case you've missed it:

The TL;DR history

  1. In the beginning, there was make, and Gates did not own make, so Gates said "Let there be MSBuild" and there was MSBuild.
  2. And MSBuild used the *.*proj files from Visual Studio as its inputs, which were formed of terrible XML, and verily it was impossible to use without a Visual Studio license.
public class Whatever
{
public async Task<int> Something()
{
await Task.Delay(1).ConfigureAwait(false);
await Task.Delay(1).ConfigureAwait(true);
return 0;
}
}
@markrendle
markrendle / dockdnx.sh
Created February 22, 2016 19:24
Docker script to run `dnx` commands using CoreCLR
#! /usr/bin/env bash
WORKDIR=''
PROJECTDIR=$PWD
while [ ! -f "${PROJECTDIR}/global.json" ] ; do
WORKDIR="/$(basename $PROJECTDIR)${WORKDIR}"
PROJECTDIR=$(dirname $PROJECTDIR)
if [ $PROJECTDIR == '/' ] ; then
echo No global.json found in any parent directories. Aborting.
exit 1
@markrendle
markrendle / gulpfile.js
Created November 5, 2015 12:12
Pass an argument to Gulp to only run a subset of Specs
"use strict";
const gulp = require('gulp'),
mocha = require('gulp-mocha'),
minimist = require('minimist');
const knownOptions = {
string: 'spec',
default: { spec: '*' }
};
public class ClaimsPrincipalBuilder
{
public static ClaimsPrincipal FromDictionary(IDictionary<string, string> source)
{
var claims = source.Select(pair => new Claim(pair.Key, pair.Value));
var identity = new ClaimsIdentity(claims);
return new ClaimsPrincipal(identity);
}
}
@markrendle
markrendle / ClaimsMiddleware.cs
Last active August 29, 2015 14:23
Middleware example
using System.Linq;
using Microsoft.AspNet.Builder;
namespace StealthProject.Mvc
{
public static class AuthenticationMiddleware
{
private static readonly char[] Eq = { '=' };
public static IApplicationBuilder UseHeaderClaims(this IApplicationBuilder app)