Skip to content

Instantly share code, notes, and snippets.

View lukasz-pyrzyk's full-sized avatar
🏠
Working from home

Łukasz Pyrzyk lukasz-pyrzyk

🏠
Working from home
View GitHub Profile
[Fact]
public void EntityWithArrayCanBeFlattened()
{
var root = new Parent
{
Childrens = new[] { new Children { Name = "Łukasz" } }
};
var flattened = TableEntity.Flatten(root, new OperationContext());
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace TestMvc.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
@lukasz-pyrzyk
lukasz-pyrzyk / PriorityQueue.cs
Last active December 20, 2016 21:29
A Priority queue of T based on IComparable
using System;
using System.Collections;
using System.Collections.Generic;
namespace ProjectForTests
{
public class PriorityQueue<T> : IEnumerable<T> where T : IComparable<T>
{
private readonly LinkedList<T> _items = new LinkedList<T>();
public class SerializationUtils
{
public const PrefixStyle Style = PrefixStyle.Fixed32;
public static int GetLengthOfPackage(byte[] buffer)
{
int size;
Serializer.TryReadLengthPrefix(buffer, 0, buffer.Length, Style, out size);
return size;
}
[ProtoContract]
[ProtoInclude(500, typeof(InsertRequest))]
public abstract class Request
{
public virtual RequestType RequestType { get; set; }
}
[ProtoContract]
public class InsertRequest : Request
{
public override RequestType RequestType { get; set; } = RequestType.Insert;
[ProtoMember(1)]
public string Key { get; set; }
[ProtoMember(2)]
public byte[] Object { get; set; }
using ProtoBuf;
namespace Kronos.Core.StatusCodes
{
[ProtoContract]
public enum RequestStatusCode : ushort
{
[ProtoEnum]
Unknown = 0,
using ProtoBuf;
namespace Kronos.Core.Requests
{
[ProtoContract]
public enum RequestType : ushort
{
[ProtoEnum]
Unknown = 0,
<configuration>
<runtime>
<gcServer enabled="true"/>
</runtime>
</configuration>
@lukasz-pyrzyk
lukasz-pyrzyk / XGainServer.cs
Last active March 23, 2016 20:51
StartSynchronously
[..]
namespace XGain
{
public class XGainServer : IServer
{
public event EventHandler<StartArgs> OnStart;
public event EventHandler<MessageArgs> OnNewMessage;
public event EventHandler<ErrorArgs> OnError;
private readonly Func<IProcessor<MessageArgs>> _requestProcessorResolver;