Skip to content

Instantly share code, notes, and snippets.

@abdullin
abdullin / SimpleMessage.cs
Created October 24, 2011 11:37
SimpleMessage
/// <summary>
/// Source: https://gist.github.com/1308830
/// This simple envelope includes only:
/// <code>
/// Header - int32
/// TotalLength - int32
/// IdLength - int32
/// UTF8-encoded message ID - byte[IdLength]
/// ContractLength - int32
/// UTF-encoded contract name 0 byte[ContractLength]
/// <summary>
/// Creates convention-based routing rules
/// </summary>
public sealed class RedirectToDynamicCommand
{
readonly IDictionary<Type, Wire> _dict = new Dictionary<Type, Wire>();
sealed class Wire
{
public MethodInfo Method;
@abdullin
abdullin / cqrs-search.html
Created February 2, 2012 16:51
Snippet that does AJAX search over a denormalized projection (handled by server) in async
// Snippet that shows AJAX search over a denormalized projection (handled by server) in async
// for sending commands in async - just do the AJAX post to server
// for getting changes - just poll the server for view version
// for cases when polling is expensive - use web sockets.
<script type="text/javascript">
$(document).ready(function () {
$('#searchButton').click(function () {
GetData($('#searchbox').val());
@abdullin
abdullin / lock_user.cs
Created September 14, 2012 14:01
Rough cuts of improved Simple Testing
// sample unit test for a command "LockUser"
public class lock_user : user_syntax
{
static readonly UserId id = new UserId(1);
static readonly SecurityId sec = new SecurityId(1);
static readonly TimeSpan fiveMins = TimeSpan.FromMinutes(5);
[Test]
@abdullin
abdullin / gist:3724348
Created September 14, 2012 20:00
Advanced A+ES with domain services
// This is slightly advanced usage scenario of Lokad A+ES tests, that shows
// setting up test implementations of domain services in ES+friendly way
// (really simple) that also prints out in the specifications. Price is an
// instance of IPricingService, used by Application service, while Clock
// is a static singleton actually.
[Test]
public void with_multiple_entries_and_previous_balance()
@abdullin
abdullin / 2012-12-10-btw-outline.md
Created December 10, 2012 04:54
Being The Worst

Topic Context

  • Module 1
    • The worst welcome E001
    • Messaging basics E002
    • Commanding your words E003
    • Event sourcing basics E004
    • Aggregating stories E005
    • Community Code and questions 1 E006
    • Re-Factory E007
  • Frameworks over forms is a design obsession E008
@abdullin
abdullin / FetchEventStoreProcessor.cs
Created March 4, 2013 06:44
Samples of commands in test client used for event store manipulation (fetching it to local storage and searching). They mostly leverage Lokad.CQRS framework and test client interactive shell (see, for example, beingtheworst.com source: https://github.com/beingtheworst/btw-gtd)
public class FetchEventStoreProcessor : ICommandProcessor
{
public string Key { get { return "FETCH"; } }
public string Usage { get { return "FETCH <remoteConfig> [<folderNameInLokadData>]"; } }
public bool Execute(CommandProcessorContext context, CancellationToken token, string[] args)
{
if (args == null || args.Length == 0)
{
context.Log.Error("No remoteConfig provided.");
@abdullin
abdullin / MultiProjections.cs
Created March 12, 2013 17:25
Trying to figure out projection semantics
void Main()
{
dynamic processor = null;
bool stopRequested;
while(!stopRequested)
{
@abdullin
abdullin / NonSerializingMemoryStore.cs
Last active December 15, 2015 19:08
Example of memory key-value storage (to be used together with ProjectionRebuilder of Lokad.CQRS) that allows really fast rebuilds by skipping serialization step.
public sealed class NonSerializingMemoryDocumentStore : IDocumentStore
{
readonly ConcurrentDictionary<string,IStoreInfo> _store = new ConcurrentDictionary<string, IStoreInfo>();
readonly IDocumentStrategy _strategy;
public interface IStoreInfo
{
IEnumerable<DocumentRecord> Enumerate();
}
Development position in Moscow. Contact @abdullin.
Requirements:
* Higher engineering education;
* English language proficiency (reading technical documents, correspondence, speaking);
* Excellent knowledge of PHP/MySQL/Javascript (JQuery);
* Good knowledge of HTML/CSS;
* Basic knowledge of the Linux operation and administering;