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
-include env | |
IMAGENAME := $(shell basename `git rev-parse --show-toplevel`) | |
NAMESPACE := user | |
SHA := $(shell git rev-parse --short HEAD) | |
timestamp := $(shell date +"%Y%m%d%H%M") | |
.PHONY: download echo build run stop start rmf rmi | |
download: |
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 KeyValuePairExtension | |
{ | |
public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> source, out TKey key, out TValue value) | |
{ | |
key = source.Key; | |
value = source.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
public static class StaticReflection | |
{ | |
public static MemberExpression GetMemberExpression(LambdaExpression expression) | |
{ | |
return GetMemberExpression() ?? throw new ArgumentException(@"Not a member access", nameof(expression)); | |
MemberExpression GetMemberExpression() | |
{ | |
switch (expression.Body.NodeType) | |
{ |
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 AccessPrivateWrapper : DynamicObject | |
{ | |
/// <summary> | |
/// The object we are going to wrap | |
/// </summary> | |
private readonly object _instance; | |
/// <summary> | |
/// Specify the flags for accessing members | |
/// </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
/******************************************************* | |
* | |
* Created by: Alexander Puzynia aka WerWolf | |
* Created: 17.10.2010 23:36 | |
* | |
* File: MemberAccessorHelper.cs | |
* Remarks: | |
* | |
* History: | |
* 17.10.2010 23:36 - Create Wireframe |
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 CustomDbContext : DbContext | |
{ | |
// ... | |
protected override void OnConfiguring(DbContextOptionsBuilder options) | |
{ | |
// Replace default materializer source to custom, to convert DateTimes | |
options.ReplaceService<IEntityMaterializerSource, DateTimeKindEntityMaterializerSource>(); | |
base.OnConfiguring(options); |
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 EnumConverter<TEnum> | |
where TEnum : Enum | |
{ | |
private static readonly Dictionary<int, TEnum> _values; | |
static EnumConverter() | |
{ | |
_values = new Dictionary<int, TEnum>(); | |
var enumValues = Enum.GetValues(typeof(TEnum)); |
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
import logging | |
__author__ = 'WerWolf' | |
def trace(logger, level=logging.INFO): | |
def wrapped(func): | |
def tmp(*args, **kwargs): | |
if logger.isEnabledFor(level): | |
logger.log(level, "Start %s" % func.__name__) |
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; | |
namespace DataAccess | |
{ | |
public static class TypeExtensions | |
{ | |
public static Type? SearchType(this Type type, Type searchType) | |
{ | |
return searchType.IsInterface | |
? SearchInterfaceType(type, searchType) |
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 WithTimeoutExtension | |
{ | |
public static Task WithTimeout(this Task task, int timeout, string actionName = null) => task.WithTimeout(TimeSpan.FromMilliseconds(timeout), actionName); | |
public static async Task WithTimeout(this Task task, TimeSpan timeout, string actionName = null) | |
{ | |
var delay = Task.Delay(timeout); | |
var completedTask = await Task.WhenAny(task, delay); | |
if (completedTask == task) | |
{ |
OlderNewer