Skip to content

Instantly share code, notes, and snippets.

View Calabonga's full-sized avatar
💭
Пишите правильный код

Sergei Calabonga Calabonga

💭
Пишите правильный код
View GitHub Profile
@Calabonga
Calabonga / Directory.Build.props
Created May 4, 2022 01:39
Visual Studio properties for all projects
<Project>
<PropertyGroup>
<!-- <LangVersion>latest</LangVersion> -->
<!--<LangVersion>preview</LangVersion>-->
<LangVersion>8</LangVersion>
</PropertyGroup>
</Project>
@Calabonga
Calabonga / AppSettings.cs
Last active January 20, 2025 09:09
Console Application Template
namespace Samples;
public class AppSettings
{
public string? Name { get; set; }
}
@Calabonga
Calabonga / JsonSerializerOptions Demo
Created September 3, 2022 03:44
JsonSerializerOptions
var options = new JsonSerializerOptions
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
ReferenceHandler = ReferenceHandler.IgnoreCycles,
WriteIndented = true
}
var json = JsonSerializer.Serialize(state, options);
@Calabonga
Calabonga / BenchmarkTemplate.cs
Created December 22, 2022 01:01
Benchmarking with BenchmarkDotNet
[RankColumn]
[HideColumns(new string[] { "Job" })]
[MemoryDiagnoser(false)]
[SimpleJob(RuntimeMoniker.Net60)]
[SimpleJob(RuntimeMoniker.Net70)]
[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByMethod)]
public class Benchmark
{
// ... start from here
}
@Calabonga
Calabonga / Money.cs
Created March 11, 2024 03:04
Implicit operators demo
public struct Money
{
private readonly double _amount;
public Money(double amount)
{
_amount = amount;
}
public double Amount => _amount;
@Calabonga
Calabonga / SomeProjectFile.csproj
Created August 16, 2024 00:17
Copy DLLs after Visual Studio Build
<Target Name="CopyDLLs" AfterTargets="Build">
<Message Text="Executing Copy Command Task" Importance="High" />
<PropertyGroup>
<PublishedCommandsDir>..\..\..\..\Calabonga.Commandex.Shell\PublishedCommands</PublishedCommandsDir>
</PropertyGroup>
<Copy SourceFiles="$(TargetDir)$(ProjectName).dll;$(TargetDir)$(ProjectName).pdb" DestinationFolder="$(PublishedCommandsDir)" />
<Message Text="Command $(ProjectName) successfully copied" Importance="High" />
</Target>
@Calabonga
Calabonga / Entity.cs
Created March 21, 2025 03:16
Entity and Value Object Implementations
public abstract class Entity : IEquatable<Entity>
{
protected Entity(Guid id)
{
Id = id;
}
public Guid Id { get; private init; }
public override bool Equals(object? obj)
@Calabonga
Calabonga / settings.json
Created August 19, 2025 12:54
rest-client.settings
{
"rest-client.environmentVariables": {
"$shared": {},
"develop":{},
"production": {}
},
"rest-client.previewOption": "full",
"rest-client.enableTelemetry": false,
"rest-client.previewResponseInUntitledDocument": false,
"rest-client.showResponseInDifferentTab": false,