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.Linq; | |
using Newtonsoft.Json; | |
namespace XXX | |
{ | |
[JsonConverter(typeof(StructWrapperConverter))] | |
public sealed class StructWrapper<T> where T : struct | |
{ | |
public T Value { get; } |
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
pragma solidity ^0.5.2; | |
contract Owned { | |
address public owner; | |
constructor() public { | |
owner = tx.origin; | |
} | |
modifier onlyOwner { |
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; | |
namespace ConsoleApp28 | |
{ | |
public readonly struct Unit | |
{ | |
public static Unit Instance { get; } = new Unit(); | |
} | |
public class State<S, A> |
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
public static class XEnumerable | |
{ | |
public static (T1[], T2[]) Unzip<T1, T2>(this IEnumerable<(T1 x, T2 y)> source) | |
{ | |
if (source is IReadOnlyCollection<(T1, T2)> roc) | |
{ | |
T1[] xs = new T1[roc.Count]; | |
T2[] ys = new T2[roc.Count]; | |
int i = 0; | |
foreach (var (x, y) in source) |
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
void Main() | |
{ | |
var files = Directory.EnumerateFiles(@"C:\Users\me\Documents\Repos\myrepo\", "*.csproj", SearchOption.AllDirectories); | |
foreach (var csprojPath in files) | |
{ | |
PatchCsProj(csprojPath); | |
} | |
} | |
void PatchCsProj(string path) |
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.Linq; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Newtonsoft.Json; | |
class Program | |
{ | |
class Comment |
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
var graph = GraphDsl.Create(b => | |
{ | |
b.From(new RabbitSource<StartProcessTriggerMessage>(workerSettings.RoutingKey, mqFactory)) | |
.Via(Flow.Create<RabbitMessage<StartProcessTriggerMessage>>() | |
.SelectAsync(Environment.ProcessorCount, async message => | |
{ | |
var stateInfoResult = await Result.TryAsync(() => | |
RetryApiFuncAsync(() => GetOmsStateInfoApiClient( | |
message.Data.Trigger.PrincipalToken, | |
message.Data.Trigger.RequestId) |
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
void Main() | |
{ | |
var v = from x in 10.AsResult() | |
from y in 0.AsResult() | |
select Result.Try (() => x/y); | |
v.Dump(); | |
} |
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.Linq; | |
using System.Threading.Tasks; | |
using Akka.Actor; | |
using Akka.Streams; | |
using Akka.Streams.Dsl; | |
using Directive = Akka.Streams.Supervision.Directive; | |
namespace ConsoleApp9 | |
{ |
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
void Main() | |
{ | |
var foo = new C { B = new B { A = new A() }}; | |
var helper = ExpressionHelper<C>.GetDelegate<A>("B.A"); | |
helper(foo).Dump(); | |
} | |
class A { | |
public int X => 10; | |
} |