Skip to content

Instantly share code, notes, and snippets.

@manne
manne / azure-devops-themes-custom-properties.css
Created November 28, 2018 12:47
Defined custom properties of Azure DevOps Dark Theme
:root {
--palette-primary-shade-30: 184, 216, 255;
--palette-primary-shade-20: 152, 198, 255;
--palette-primary-shade-10: 121, 181, 255;
--palette-primary: 0, 120, 212;
--palette-primary-tint-10: 82, 143, 217;
--palette-primary-tint-20: 73, 126, 191;
--palette-primary-tint-30: 55, 96, 145;
--palette-primary-tint-40: 34, 59, 89;
--palette-neutral-100: 255, 255, 255;
@manne
manne / Microsoft.Extensions.DependencyInjection_Factory.linq
Created December 1, 2019 12:08
Microsoft.Extensions.DependencyInjection Factory
<Query Kind="Program">
<NuGetReference>Microsoft.Extensions.DependencyInjection</NuGetReference>
<NuGetReference>Microsoft.Extensions.DependencyInjection.Abstractions</NuGetReference>
<Namespace>Microsoft.Extensions.DependencyInjection</Namespace>
<Namespace>Microsoft.Extensions.DependencyInjection.Extensions</Namespace>
</Query>
void Main()
{
var sc = new ServiceCollection();
@manne
manne / NullableExtensions.cs
Last active January 5, 2020 10:50
Provides a deconstructor and a method in the "TryGet" style for nullable types in C#.
void Main()
{
Nullable<int> n = 3;
n.HasValue(out var i).Dump();
i.Dump();
var (a, value) = n;
a.Dump();
value.Dump();
@manne
manne / LICENSE
Last active January 12, 2020 23:14
Support immutable types for System.Text.Json
MIT License
Copyright (c) 2020 Manuel Pfemeter
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWAR
@manne
manne / roslyn_nullable_context.linq
Last active January 28, 2020 22:06
Gets the NullableContext of a certain position
<Query Kind="Program">
<NuGetReference>Microsoft.CodeAnalysis</NuGetReference>
<NuGetReference>Microsoft.CodeAnalysis.Compilers</NuGetReference>
<NuGetReference>Microsoft.CodeAnalysis.CSharp</NuGetReference>
<Namespace>Microsoft.CodeAnalysis</Namespace>
<Namespace>Microsoft.CodeAnalysis.CSharp</Namespace>
<Namespace>Microsoft.CodeAnalysis.CSharp.Syntax</Namespace>
</Query>
void Main()