Skip to content

Instantly share code, notes, and snippets.

View martincostello's full-sized avatar
🚀
Coding stuff

Martin Costello martincostello

🚀
Coding stuff
View GitHub Profile
@martincostello
martincostello / XunitTestOutputLogger.cs
Created February 26, 2016 15:04
BenchmarkDotNet Logger for Xunit
namespace MartinCostello
{
using BenchmarkDotNet.Loggers;
using Xunit.Abstractions;
/// <summary>
/// A class that writes output to the test output for Xunit. This class cannot be inherited.
/// </summary>
public sealed class XunitTestOutputLogger : ILogger
{
@martincostello
martincostello / keybase.md
Last active March 25, 2016 14:31
keybase.io Verification Gist

Keybase proof

I hereby claim:

  • I am martincostello on github.
  • I am martincostello (https://keybase.io/martincostello) on keybase.
  • I have a public key whose fingerprint is 09E6 0E06 CD38 314B 9F25 1C62 74A5 B223 F73B 2AF3

To claim this, I am signing this object:

@martincostello
martincostello / Build.cmd
Last active November 8, 2017 09:30
How To Find Which Assemblies Cause The MSB3277 Warning
REM How to find the root cause of the warning:
REM "MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved".
REM 1) Run MSBuild with the option '/verbosity:detailed' and pipe the output to a file.
REM 2) Find all lines that contain the text "There was a conflict between ".
REM 3) Fix all conflicting assembly versions in any project(s).
REM For .NET Framework/MSBuild:
MSBuild.exe MyProject.msbuild /verbosity:detailed >> _AssemblyConflicts.log
REM For .NET Core:
@martincostello
martincostello / 2.2.401.md
Last active September 15, 2019 11:35
Advent Of Code Benchmarks for .NET Core 2.2 vs. 3.0
BenchmarkDotNet=v0.11.5, OS=Windows 10.0.18362
Intel Core i7-6700HQ CPU 2.60GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.2.401
  [Host]     : .NET Core 2.2.6 (CoreCLR 4.6.27817.03, CoreFX 4.6.27818.02), 64bit RyuJIT
  DefaultJob : .NET Core 2.2.6 (CoreCLR 4.6.27817.03, CoreFX 4.6.27818.02), 64bit RyuJIT

@martincostello
martincostello / 2.2.401.md
Last active September 16, 2019 19:07
Project Euler Benchmarks for .NET Core 2.2 vs. 3.0

TODO

@martincostello
martincostello / nac.cpp
Created October 8, 2019 18:58
University Year 2 C++ Project - A Noughts and Crosses (Tic Tac Toe) Game
#include <iostream>
#include <cstdlib>
using namespace std;
char matrix[3][3];
int win(0);
int loss(0);
int draw(0);
char player;
@martincostello
martincostello / update-dotnet-sdk.yml
Last active November 14, 2020 14:26
GitHub Actions workflow to update the .NET SDK
name: update-dotnet-sdk
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
update-dotnet-sdk:
name: Update .NET SDK
runs-on: ubuntu-latest
steps:
@martincostello
martincostello / Console.Tests\Console.Tests.csproj
Last active June 22, 2021 16:31
.NET global usings for code and tests
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
</ItemGroup>
@martincostello
martincostello / HttpResponseJsonExtensions.cs
Last active November 28, 2021 09:26
Extensions for using the JSON source generator with Minimal APIs
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
namespace Microsoft.AspNetCore.Http;
/// <summary>
/// Provides extension methods for writing a JSON serialized value to the HTTP response.
/// </summary>
/// <remarks>
@martincostello
martincostello / AddNumbers.Tests\AddNumbers.Tests.csproj
Created December 4, 2021 15:34
An extension method to turn a string into a sequence of numbers using .NET 6 Generic Math
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Shouldly" Version="4.0.3" />
</ItemGroup>
<ItemGroup>