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 int CeilingOfDivisionBy( | |
this int value, | |
int divisor) | |
{ | |
var intQuotient = value / divisor; | |
var remainder = value % divisor; | |
return remainder == 0 | |
? intQuotient | |
: intQuotient + 1; |
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>Generates set of unique random numbers from 1 to specified max value.</summary> | |
public static ISet<int> NextUniqueSet( | |
this Random random, | |
int count, | |
int maxValueInclusive) | |
{ | |
// Taken from https://stackoverflow.com/a/2394292/10401390 | |
if (maxValueInclusive < count) | |
{ |
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; | |
// using System.Data.Common; | |
public interface IDbConnectionResolver | |
{ | |
IDbConnectionWrapper Resolve(); | |
} | |
public interface IDbConnectionWrapper : IDisposable | |
{ |
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; | |
// using System.Reflection; | |
// using System.Runtime.ExceptionServices; | |
[System.Diagnostics.DebuggerStepThrough] | |
public static void InvokeAsGeneric( | |
this MethodInfo method, | |
object target, | |
Type[] typeArguments, | |
params object[] arguments) |
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 class ThreadSafeCache<TKey, TItem> | |
{ | |
private readonly ConcurrentDictionary<TKey, Lazy<TItem>> _cache = new ConcurrentDictionary<TKey, Lazy<TItem>>(); | |
private readonly object _lock = new object(); | |
public TItem GetOrAdd(TKey key, Func<TKey, TItem> itemFactory) | |
{ | |
Lazy<TItem> item; | |
if (!_cache.TryGetValue(key, out 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
public static class LightLazy | |
{ | |
public static LightLazy<TItem> Create<TItem>(Func<TItem> itemConstructor) | |
where TItem : class | |
=> new LightLazy<TItem>(itemConstructor); | |
} | |
public struct LightLazy<TItem> | |
where TItem : class | |
{ |
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
{ | |
"$type": "Manisero.DSLExecutor.Domain.ExpressionsDomain.BatchExpression`1[[System.Int32, mscorlib]], Manisero.DSLExecutor", | |
"SideExpressions": { | |
"$type": "Manisero.DSLExecutor.Domain.ExpressionsDomain.IExpression[], Manisero.DSLExecutor", | |
"$values": [ | |
{ | |
"$type": "Manisero.DSLExecutor.Domain.ExpressionsDomain.FunctionExpression`2[[Manisero.DSLExecutor.Parser.Json.Tests.TestsDomain.LogFunction, Manisero.DSLExecutor.Parser.Json.Tests],[Manisero.DSLExecutor.Domain.FunctionsDomain.Void, Manisero.DSLExecutor]], Manisero.DSLExecutor", | |
"FunctionType": "Manisero.DSLExecutor.Parser.Json.Tests.TestsDomain.LogFunction, Manisero.DSLExecutor.Parser.Json.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", | |
"ArgumentExpressions": { | |
"$type": "System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[Manisero.DSLExecutor.Domain.ExpressionsDomain.IExpression, Manisero.DSLExecutor]], mscorlib", |
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 Type GetGenericTypeDefinitionImplementation(this Type type, Type definition) | |
{ | |
if (definition.IsInterface) | |
{ | |
return type.GetGenericInterfaceDefinitionImplementation(definition); | |
} | |
else | |
{ | |
return type.GetGenericClassDefinitionImplementation(definition); | |
} |
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
[core] | |
longpaths = true | |
[http] | |
sslVerify = false | |
[credential] | |
helper = manager-core | |
[pull] | |
rebase = true | |
[push] | |
default = simple |