This file contains hidden or 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.ComponentModel; | |
using System.Diagnostics; | |
public static class OptionExtensions | |
{ | |
public static Either<TSuccess, TFailure> ToEither<TSuccess, TFailure>(this Option<TSuccess> option, TFailure failureValue) | |
{ | |
if (option.HasValue) | |
return new Either<TSuccess, TFailure>(option.Value); |
This file contains hidden or 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.ComponentModel; | |
using System.Diagnostics; | |
public static class EitherExtensions | |
{ | |
[DebuggerStepThrough] | |
public static Either<TNew, TFailure> IfSuccess<TCurrent, TNew, TFailure>(this Either<TCurrent, TFailure> either, Func<TCurrent, Either<TNew, TFailure>> continuation) | |
{ | |
if (!either.Succeeded) |
This file contains hidden or 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.Diagnostics.CodeAnalysis; | |
public struct Option<T> : IEquatable<Option<T>> | |
{ | |
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] | |
public static readonly Option<T> None = new Option<T>(); | |
private readonly T _value; | |
private readonly bool _hasValue; |
This file contains hidden or 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
# Auto detect text files and perform LF normalization: http://stackoverflow.com/questions/170961/whats-the-best-crlf-carriage-return-line-feed-handling-strategy-with-git/10855862#10855862 | |
* text=auto | |
*.sql diff | |
*.ts diff | |
*.xml diff |
This file contains hidden or 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.Collections.Generic; | |
using System.Linq; | |
public static class CollectionExtensions | |
{ | |
public static void RemoveAll<T>(this ICollection<T> @this, Func<T, bool> predicate) | |
{ | |
List<T> list = @this as List<T>; |
This file contains hidden or 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 Newtonsoft.Json; | |
using Xunit; | |
[Fact] | |
public void SerializationTest() | |
{ | |
var money = Money.Create(1, "USD"); | |
string json = JsonConvert.SerializeObject(money); | |
Money result = JsonConvert.DeserializeObject<Money>(json); |
This file contains hidden or 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
alias noyp="cd C:/SRC/NameOfYourProject/" # noyp is example abbreviation from NameOfYourProject | |
alias blef="cd C:/Work/Github/Blef/" | |
alias brlocal="git br | grep local" |
This file contains hidden or 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 JetBrains.Annotations; | |
public class EnumGuard | |
{ | |
[Pure] | |
public static ArgumentOutOfRangeException CreateMissingEnumException<T>(string paramName, T value) | |
where T : struct | |
{ | |
return new ArgumentOutOfRangeException( |
This file contains hidden or 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.ComponentModel; | |
public static class ISynchronizeInvokeExtensions | |
{ | |
public static void InvokeOnUiThread<T>(this T @this, Action<T> action) where T : ISynchronizeInvoke | |
{ | |
if (@this.InvokeRequired) | |
{ | |
@this.Invoke(action, new object[] { @this }); |
This file contains hidden or 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
# taken from https://github.com/aspnet/SignalR-samples/blob/master/.gitattributes | |
# Auto detect text files and perform LF normalization | |
* text=auto | |
*.doc diff=astextplain | |
*.DOC diff=astextplain | |
*.docx diff=astextplain | |
*.DOCX diff=astextplain | |
*.dot diff=astextplain |