Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Concurrent;
using Anotar.Serilog;
using Microsoft.ServiceBus.Messaging;
using RezStream.Infrastructure;
namespace RezCloud.Infrastructure.AzureBus
{
public class Queues : Enumeration<Queues, string>
{
@hyrmn
hyrmn / gist:51ca84d9a60a63ab66e31cc5871e4b84
Last active May 28, 2017 10:08
German spelt pancakes
400g of spelt flour, type 630 (finely ground)
3 eggs (size L)
750 ml of almond milk
a little salt and some sparkling water, so they'll be very fluffy 👍
If you want them a little sweeter add some sugar, Xylit, or Erythrit, or coconut sugar.
I mixed the sugar all the time. 3 spoons of Xylit and one of coconut sugar.
It's up to you, you don't have to add sugar, maybe you want to try a spicy one.
function prompt
{
$(get-location) + "> "
}
function Get-Batchfile ($file) {
$cmd = "`"$file`" & set"
cmd /c $cmd | Foreach-Object {
$p, $v = $_.split('=')
Set-Item -path env:$p -value $v
public static class AzureConManagerSqlPersistenceWireupExtensions
{
public static SqlPersistenceWireup UseInAzureConfiguredSqlPersistence(this Wireup wireup, string connectionName)
{
var factory = new AzureConfigurationConnectionFactory(connectionName);
return new SqlPersistenceWireup(wireup, factory);
}
}
public class AzureConfigurationConnectionFactory : ConfigurationConnectionFactory
public static class IDocumentSessionExtensions
{
private static readonly Policy RetryPolicy = Policy
.Handle<WebException>(ex => TransientErrors.Contains(ex.Status))
.WaitAndRetry(new[]
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(3)
});
@hyrmn
hyrmn / EndToEndTests.cs
Created July 29, 2012 16:27
My incomplete but evolving understanding of CQRS
using System;
using System.Reflection;
using CommonDomain;
using CommonDomain.Core;
using CommonDomain.Persistence;
using CommonDomain.Persistence.EventStore;
using EventStore;
using EventStore.Dispatcher;
public class DateAndTimeJsonConverter : IsoDateTimeConverter
{
public DateAndTimeJsonConverter()
{
//NOTE: Need a TypeConverter to control formatting of Dictionary Keys. This applies the type conveter to types you don't control:
// http://stackoverflow.com/questions/3068453/can-you-assign-a-typeconverter-without-a-typeconverterattribute
TypeDescriptor.AddAttributes(typeof(LocalDate), new TypeConverterAttribute(typeof(LocalDateTypeConverter)));
TypeDescriptor.AddAttributes(typeof(LocalDate?), new TypeConverterAttribute(typeof(LocalDateTypeConverter)));
}
@hyrmn
hyrmn / thoughs.md
Last active June 22, 2016 23:51
Raven 2.5 with 500 tenants on several nodes.

The bullet points for 500 tenants on 2.5:

  • Automate tenant creation across all nodes
  • Active-active read/write. Let Raven handle syncing behind the scenes; it's good at this
  • More RAM is better than less RAM
  • Understand how your hosting infra affects Raven. We had to write custom failover code because of all of the virtual layers on Azure (we host on Azure VMs) (https://gist.github.com/hyrmn/7262c3d7450793550e48)
  • Expect replication to randomly not be set up even if it tells you it succeeded. Have logging for this (we have Raven logging to Seq)
  • Pre-stage indexes. Use an index naming scheme to support this (eg, PeopleSearch changes get deployed as PeopleSearch2). This means you should never reference an index by string. RavenDB 3.x with side-by-side indexes address this I think
  • Running is fine but server restarts are slow and messy. Block client traffic to the node and let clients failover to other node(s)
  • Multi-tenant on Raven is incredibly straightforward; use it to isolate at appropri
<!doctype html>
<html>
<head>
<title>Omphaloskepsis</title>
</head>
<body>
<button type="belly" class="innie" id="navel">@</button>
<script>
var navel = document.getElementById('navel');
public class ServiceBus
{
private readonly string _asbSecondaryUri = TypedCloudConfigurationManager.GetSetting("azure.serviceBus.connStrSecondary");
private readonly string _asbUri = TypedCloudConfigurationManager.GetSetting("azure.serviceBus.connStr");
private readonly bool _hasSecondary;
private readonly bool _isSyphon;
private readonly Lazy<MessagingFactory> _messagingFactory;
private readonly NamingStrategy _namingStrategy =
new NamingStrategy(TypedCloudConfigurationManager.GetSetting("azure.serviceBus.namingStrategy"));