Skip to content

Instantly share code, notes, and snippets.

@thoemmi
thoemmi / Create-WorkflowDiagramFromWitd.ps1
Last active February 10, 2020 19:59
This Powershell scripts generates a nice workflow diagram from a TFS work item template definition file. See http://thomasfreudenberg.com/archive/2018/01/16/generating-workflow-diagram-for-witd/ for details
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, HelpMessage="Path to work item template definition file")]
[string]
$witdPath
)
# path to dot.exe; e.g. use "choco install graphviz"
$dotPath = "C:\ProgramData\chocolatey\bin\dot.exe"
@thoemmi
thoemmi / EnumFlagsConverter.cs
Created September 5, 2018 15:31
JSON Converter for enum flags
public class EnumFlagsConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var x = ((Enum) value).ToString();
var list = new List<string>();
foreach (var v in x.Split(new[] {", "}, StringSplitOptions.RemoveEmptyEntries))
{
list.Add(v);

Keybase proof

I hereby claim:

  • I am thoemmi on github.
  • I am thoemmi (https://keybase.io/thoemmi) on keybase.
  • I have a public key ASD1LqmfVwJ9qgVmFamgIyLV28FTLDOwzDiIph2oyBtA9go

To claim this, I am signing this object:

@thoemmi
thoemmi / AnsiConsoleExtensions.cs
Created June 13, 2022 20:44
Extension method for Spectre.Console to write JSON with syntax highlighting
public static class AnsiConsoleExtensions
{
public static IAnsiConsole WriteJson(this IAnsiConsole console, JsonElement node, JsonStyle? jsonStyle = null)
{
ArgumentNullException.ThrowIfNull(console);
ArgumentNullException.ThrowIfNull(node);
console.WriteJson(node, jsonStyle ?? JsonStyle.Default, 0);
return console;
}