Skip to content

Instantly share code, notes, and snippets.

public class PlayMassTransitModule : MassTransitModuleBase
{
public override void Load()
{
base.Load();
RegisterEndpointFactory(x =>
{
x.RegisterTransport<LoopbackEndpoint>();
x.RegisterTransport<MulticastUdpEndpoint>();
@ekepes
ekepes / BadBadBadGetter.cs
Created February 20, 2012 19:35
Bad, bad, bad getter
public int SomeCountValue
{
get
{
if (_someCountValue == -1)
{
using (IUnitOfWork unitOfWork = new UnitOfWork())
{
_someCountValue = unitOfWork.GetQueryObjectInstance<ISomeQuery>()
.Where(Property1, Property2, Property3, Property4 ?? 0).Select();
@ekepes
ekepes / SpecificationFixture.cs
Last active December 30, 2015 03:39 — forked from yevhen/SpecificationFixture.cs
Pull in all of the specifications in the test assembly.
[TestFixture]
public class SpecificationFixture
{
[Test, TestCaseSource("GetSpecificationTestCases")]
public void Verify(SpecificationToRun spec)
{
var runner = new SpecificationRunner();
RunResult result = runner.RunSpecifciation(spec);
if (result.Passed)
Value objects are an important concept in DDD. This kata is made both to learn value objects and to learn better ways of testing.
Write a probability value object. It should contain the following methods:
Probability CombinedWith(Probability)
Probability InverseOf()
Probability Either(Probability)
if you forget your probability math:
Either:P(A) + P(B) - P(A)P(B)
CombinedWith: P(A)P(B)
using Automatonymous;
using Dapper;
using MassTransit.Exceptions;
using MassTransit.Logging;
using MassTransit.Pipeline;
using MassTransit.Saga;
using MassTransit.Util;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

I think, I heard term "Serving Architect" from a ThoughtWorks presentation. It can be described this way.

Somebody with an experience works with a team, eliminating bottlenecks and helping them to move forward in the project. Ideally he or she would have experience of multiple roles in a software project: architect (software designer), developer, tester, lead and manager; with technical hands-on expertise covering stacks used by the team. This way a serving architect can help and share experience with any role in the team, without interfering with the team dynamics.

@ekepes
ekepes / gist:67423b6182b81e93bf08
Created March 15, 2015 01:01
An attempt to port the TcpReactorServer in Helios to F#
// Port of https://github.com/helios-io/helios/blob/dev/samples/Helios.Samples.TcpReactorServer/Program.cs
open System
open System.Net
open System.Text
open Helios.Net
open Helios.Reactor
open Helios.Reactor.Bootstrap
open Helios.Reactor.Tcp
open Helios.Topology
@ekepes
ekepes / ConsoleApplication2.cs
Last active January 8, 2022 05:00
C# implementation of a Linear Congruential Generator (LCG) for psuedorandom number generation
using System;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
var freq = new int[20];
var rng = new RandomNumberGenerator();
@ekepes
ekepes / submissions0001-anyuser.json
Created October 26, 2016 18:32
Any old user/client sends a GET to http://example.com/api/submissions/0001, they get this back:
{
"Id": "0001",
"Title": "An Awesome Talk",
"Abstract": "Magnificent abstract goes here...",
"Status": "Submitted",
"Links": [
{
"Href": "http://example.com/api/submissions/0001",
"Rel": "self",
"Method": "GET"
@ekepes
ekepes / submissions0001-owner.json
Created October 26, 2016 18:39
If I am logged in to the site (I've been given a security token, for example), when I send a GET to the same endpoint for a talk I submitted:
{
"Id": "0001",
"Title": "An Awesome Talk",
"Abstract": "Magnificent abstract goes here...",
"Status": "Submitted",
"Links": [
{
"Href": "http://example.com/api/submissions/0001",
"Rel": "self",
"Method": "GET"