Skip to content

Instantly share code, notes, and snippets.

View TylerBrinkley's full-sized avatar

Tyler Brinkley TylerBrinkley

View GitHub Profile
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
public static string Format(string format, IDictionary<string, object> valueProvider)
{
if (valueProvider == null)
{
throw new ArgumentNullException(nameof(valueProvider));
}
return Format(format, name => valueProvider.TryGetValue(name, out var value) ? (true, value) : (false, null));
}
public sealed class LogicalStringComparer : StringComparer
{
public static LogicalStringComparer LogicalOrdinal { get; } = new LogicalStringComparer(Ordinal);
public static LogicalStringComparer LogicalOrdinalIgnoreCase { get; } = new LogicalStringComparer(OrdinalIgnoreCase);
private readonly StringComparer _comparer;
public LogicalStringComparer(StringComparer comparer)
{
@TylerBrinkley
TylerBrinkley / JsonPrettifier.cs
Last active February 27, 2020 15:17
Json Prettifier and Minifier
public static string Prettify(string json)
{
var sb = new StringBuilder(json.Length * 2);
var indent = 0;
var startOfLine = false;
for (var i = 0; i < json.Length; ++i)
{
var c = json[i];
if (!char.IsWhiteSpace(c))
{