This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* JsonConverterFactory to serialize Dictionary with string as keys. | |
* This serializer will produce a json where the key becomes the property of the json item. | |
*/ | |
using System.Text.Json; | |
using System.Text.Json.Serialization; | |
namespace Bogoware.Common.JsonConverters; | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text.Json.Serialization; | |
namespace MyAwesomeProject.Shared.Utils; | |
public static class ExceptionExtensions | |
{ | |
public class ExceptionInfo | |
{ | |
public ExceptionInfo() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static readonly byte[] _oddMap = new byte[] { 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 }; | |
static bool PartitaIvaCheckSum(string value) | |
{ | |
Debug.Assert(value is not null); | |
Debug.Assert(value.Length == 11); | |
// ASSERT: value is a string of digits | |
var c0 = (byte) '0'; | |
int acc = 0; | |
byte[] codes = Encoding.ASCII.GetBytes(value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Italian fiscal id for companies | |
/// </summary> | |
public class PartitaIva: SimpleValueObject<string> | |
{ | |
public const int MaxLength = 255; | |
public PartitaIva(string value) : base(value) { } | |
private static readonly int[] _oddMap = new int[] { 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class JsonUtils | |
{ | |
/// <summary> | |
/// Indent a string containing a valid Json | |
/// </summary> | |
/// <param name="json"></param> | |
/// <returns></returns> | |
/// <exception cref="ArgumentNullException"></exception> | |
public static async Task<string> GetIndentedAsync(string json) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void LogEnvironmentInfo(ILogger<YOUR_CLASS> log) { | |
var envs = Environment.GetEnvironmentVariables(); | |
StringBuilder sb = new StringBuilder(); | |
foreach (var k in envs.Keys) sb.AppendLine($"{k}: {envs[k]}"); | |
log.LogInformation(sb.ToString()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Homebrew build logs for gradle on macOS 10.15 | |
Build date: 2019-10-23 14:03:29 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Giovanni Costagliola <giovanni.costagliola@gmail.com> | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Utils | |
{ | |
/// <summary> | |
/// Represent a Weighted Item. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.class | |
*.log | |
# sbt specific | |
.cache | |
.history | |
.lib/ | |
dist/* | |
target/ | |
lib_managed/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ATTENTION: rename this file to .gitignore!!! | |
# Ignore everything in this directory | |
* | |
# Except this file | |
!.gitignore |