Skip to content

Instantly share code, notes, and snippets.

View AlexeyRaga's full-sized avatar

Alexey Raga AlexeyRaga

  • Arbor Networks
  • Sydney, Australia
View GitHub Profile
@AlexeyRaga
AlexeyRaga / RegistrationStatusProjection.cs
Created November 25, 2012 02:18
Projection prototype
//The idea of a projection is to accumulate and maintain some persisted state
//based on events
public sealed class RegistrationStatusProjection
{
//just a writer who knows how to persist a projection
//The first type parameter is a key, the second is the PVM type.
//Look at IDocumentWriter interface in this gist
private IDocumentWriter<Guid, RegistrationStatusView> _writer;
public RegistrationStatusProjection(IDocumentStore factory)
@AlexeyRaga
AlexeyRaga / result.md
Created November 28, 2012 09:38
Unit tests in ES example

This result and specification is automatically generated based on the tests below. This can be read and verified by BAs or any business person.

Make property unused

By default unused property should not be made unused twice

Given

  • Form Created "Some Form", "formUniqueName"
  • Property Added To Form "Subject" (textbox)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@AlexeyRaga
AlexeyRaga / ConventionalSubscriptionBuilder.cs
Created February 24, 2013 02:30
An example of ConventionalSubscriptionBuilder for EasyNetQ
public sealed class ConventionalSubscriptionBuilder
{
private readonly IBus _bus;
private readonly string _handlerMethodName;
//by default handling method is name 'When'
public ConventionalSubscriptionBuilder(IBus bus, string handlerMethodName = "When")
{
if (bus == null) throw new ArgumentNullException("bus");
if (String.IsNullOrWhiteSpace(handlerMethodName)) throw new ArgumentNullException("handlerMethodName");
@AlexeyRaga
AlexeyRaga / gist:5096860
Last active December 14, 2015 13:58
Using SProcs in repositories
//private method to use SProc
private void WithStoredProcedure(string storedProcedureName, Action<SqlCommand> commandAction)
{
using (var connection = OpenConnection())
using (var command = connection.Connection.CreateCommand())
{
command.CommandText = storedProcedureName;
command.CommandType = CommandType.StoredProcedure;
commandAction(command);
}
@AlexeyRaga
AlexeyRaga / gist:5194578
Last active December 15, 2015 03:29
Extending String in typescript
interface String {
format(): string;
}
String.prototype.format = function () { return this + "-formatted"; }
// Module
module Test {
public class GetEventStoreRepository : IRepository
{
private const string EventClrTypeHeader = "EventClrTypeName";
private const string AggregateClrTypeHeader = "AggregateClrTypeName";
private const string CommitIdHeader = "CommitId";
private const int WritePageSize = 500;
private const int ReadPageSize = 500;
private readonly Func<Type, Guid, string> _aggregateIdToStreamName;
@AlexeyRaga
AlexeyRaga / example.fs
Created August 14, 2013 13:34
F# Canopy - text fixture syntax
open canopy
open canopy.runner
open helpers
start firefox
fixture "asd" {
url "http://google.com"
"input[type=text]" << "Alexey Raga"
"input[type=text]" == "Alexey Raga"
import akka.actor.Actor
import akka.actor.ActorSystem
import akka.agent.Agent
import com.typesafe.config.ConfigFactory
import akka.event.Logging
import akka.actor.Props
import kafka.utils.Utils
import java.nio.ByteBuffer
package question
import java.io.IOException
import scala.util.Random
import akka.actor.Actor
import akka.actor.ActorRef
import akka.actor.ActorSystem
import akka.actor.OneForOneStrategy