Skip to content

Instantly share code, notes, and snippets.

View alexeyzimarev's full-sized avatar
🎖️
Protecting common sense

Alexey Zimarev alexeyzimarev

🎖️
Protecting common sense
View GitHub Profile
@alexeyzimarev
alexeyzimarev / elasticsearch-nest-geoquery-example.cs
Last active September 11, 2015 07:14 — forked from crunchie84/elasticsearch-nest-geoquery-example.cs
Easy example of indexing geo-based domain objects to ElasticSearch via #nest
using Nest;
using System;
using System.Globalization;
namespace elasticsearch_nest_geoindex_demo
{
public class Location
{
public string Name { get; set; }
source https://www.nuget.org/api/v2/
nuget Nuget.CommandLine
nuget AggregateSource 0.0.300 framework: >= net452
nuget AggregateSource.EventStore 0.0.300 framework: >= net452
nuget Autofac 3.5.2 framework: >= net452
nuget EventStore.Client 3.2.1 framework: >= net452
nuget EventStore.Client.Embedded 3.2.1 framework: >= net452
nuget EventStore.SerilogAdapter 1.0.0 framework: >= net452
nuget Ix-Main 1.2.5 framework: >= net452
public class Subscription
{
public Subscription(SubscriptionId id, int maxSubscriptions)
{
...
Dispatch(new SubscriptionCreated(..., maxSubscriptions));
}
...
@alexeyzimarev
alexeyzimarev / Todo.js
Created March 21, 2016 20:06
Todo functional React component
import React, { PropTypes } from 'react'
const Todo = ({ onClick, completed, text }) => (
<li
onClick={onClick}
style={{
textDecoration: completed ? 'line-through' : 'none'
}}
>
{text}
@alexeyzimarev
alexeyzimarev / Todo.tsx
Created March 21, 2016 20:12
TypeScript version of React functional component
/// <reference path="../typings/browser.d.ts" />
import React, { PropTypes } from 'react';
interface TodoProps {
onClick: any;
completed: boolean;
text: string;
}
internal class SubscribeObserver : IRunOnStartAndStop
{
private readonly IBus _bus;
public SubscribeObserver(IBus bus)
{
_bus = bus;
}
public void OnBeforeStart()
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
namespace MassTransit.EntityFrameworkIntegration
{
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Infrastructure;
using System.Reflection;
public class AssemblyScanningSagaDbContext : DbContext
@alexeyzimarev
alexeyzimarev / BaseHandler.cs
Last active July 12, 2017 18:50
Using this base class you can handle your messages without extracting them first from the context. Context is still available.
using System.Threading.Tasks;
using MassTransit;
namespace Demo.MassTransit
{
public abstract class BaseHandler<T> : IConsumer<T> where T : class
{
protected ConsumeContext<T> Context { get; private set; }
public abstract Task Handle(T message);
@alexeyzimarev
alexeyzimarev / Program.cs
Created January 9, 2018 20:31
MassTransit v4 and .NET Core console app to run in a Docker container
using System;
using System.IO;
using System.Runtime.Loader;
using System.Threading;
using System.Threading.Tasks;
using GreenPipes;
using MassTransit;
using Microsoft.Extensions.Configuration;
using Serilog;