Skip to content

Instantly share code, notes, and snippets.

View Kritner's full-sized avatar

Russ Hammett Kritner

View GitHub Profile
@Kritner
Kritner / Blimey.cs
Created June 24, 2021 11:27
Trying out the new "record" type, hoping to get a solution for the xml documentation of properties vs constructor parameters
/// <summary>
/// Represents a blimey!
/// </summary>
/// <param name="Scoot"><inheritdoc cref="Scoot"/></param>
/// <param name="IsNeat"><inheritdoc cref="IsNeat"/></param>
public record Blimey(int Scoot, bool IsNeat)
{
/// <summary>
/// The scoot
/// </summary>
@Kritner
Kritner / IDbConnectionFactory.cs
Created January 5, 2019 02:45
DB Connection .net core
public interface IDbConnectionFactory
{
IDbConnection Get(string connectionString);
}
@Kritner
Kritner / testProject.csproj
Created November 28, 2018 00:48
barebones csproj for an xUnit test project
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
@Kritner
Kritner / Directory.Build.props
Last active October 10, 2018 23:32
Directory.Build.props
<Project>
<PropertyGroup>
<NuGet-Kritner-SolarProjection>1.0.2</NuGet-Kritner-SolarProjection>
</PropertyGroup>
</Project>
@Kritner
Kritner / Program.cs
Created October 7, 2018 17:32
Orleans getting started part 0, server config
public class Program
{
public static int Main(string[] args)
{
return RunMainAsync().Result;
}
private static async Task<int> RunMainAsync()
{
try
@Kritner
Kritner / Program.cs
Created October 7, 2018 17:27
Orleans getting started part 0, client config
public class Program
{
const int initializeAttemptsBeforeFailing = 5;
private static int attempt = 0;
static int Main(string[] args)
{
return RunMainAsync().Result;
}
@Kritner
Kritner / SolarProjectionController.cs
Last active September 8, 2018 22:52
Medium blog post - solar projection, adding form - Form typescript model
[Route("api/[controller]")]
[ApiController]
public class SolarProjectionController : ControllerBase
{
private readonly IProjectFutureEnergyCostService _service;
public SolarProjectionController(IProjectFutureEnergyCostService service)
{
_service = service;
}
@Kritner
Kritner / NUnitCategories.cs
Created September 1, 2018 19:04
"Strongly typed" NUnit categories
// Haven't figured out how to apply to assembly correctly, but added it as a flag in my base anyway
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public class BaseCategoryAttribute : CategoryAttribute { }
public class FastIntegrationTestAttribute : BaseCategoryAttribute { }
public class LongRunningIntegrationTestAttribute : BaseCategoryAttribute { }
public class UnitTestAttribute : BaseCategoryAttribute { }
public class CoreTestAttribute : BaseCategoryAttribute { }
[TestFixture, UnitTest, CoreTest]
@Kritner
Kritner / git-mv-with-history
Created April 20, 2018 19:59 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@Kritner
Kritner / FlattenAbstractObject.cs
Created March 14, 2018 20:26
Potential for flattening an abstract object into JSON for serialization/deserialization?
public class Test
{
public int Id {get;set;}
[JsonIgnore] public Foo {get;set;} = new Foo();
public BigInteger Bar
{
get => Foo.Bar;
set => Foo.Bar = value;
}