Skip to content

Instantly share code, notes, and snippets.

View 01Vladimir10's full-sized avatar
🏠
Working from home

01Vladimir10

🏠
Working from home
View GitHub Profile
@01Vladimir10
01Vladimir10 / HighlightedText.cs
Created August 19, 2023 06:50
Blazor safely highlight text in a string
using AdminPwaEditor.Web.Client.Components.Base;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
namespace AdminPwaEditor.Web.Client.Components.Controls;
public class HighlightedText : BaseComponent
{
[Parameter, EditorRequired] public string Text { get; set; } = "";
[Parameter] public string? Highlight { get; set; } = "";
@01Vladimir10
01Vladimir10 / JsonSnakeCaseNamingPolicy.cs
Created May 10, 2023 22:31
An implementation of JsonNamingPolicy for snake case, this is completly compatible with Json.NET
namespace ZuperApi.ZohoIntegration.Utils;
public class JsonSnakeCaseNamingPolicy : System.Text.Json.JsonNamingPolicy
{
public override string ConvertName(string name) => ToSeparatedCase(name, '_');
private enum SeparatedCaseState
{
Start,
Lower,