Skip to content

Instantly share code, notes, and snippets.

@gregoryyoung
gregoryyoung / gist:3665514
Created September 7, 2012 11:49
handlers
Handlers
In Domain Driven Design, there are a series of small services that sit over the top of the domain. These services known as Application Services act as a facade over the the domain model. In CQRS based systems a similar pattern is used but it has been slightly refined. The refining of this pattern can be employed successfully in both systems that use CQRS and systems that stay using a single model for supporting reads and writes as many of the advantages come from simplicity of composition. To show Command Handlers, it is best to start with a typical Application Service and refactor our way to a Command Handler.
The Application Service
A stereotypical Application Service represents a given use case of the model. The Application Service itself generally does not directly implement the use case but instead coordinates objects from the domain to meet the requirements of the use case. This sounds like a small distinction but it is a very important one, Application Services generally should not have "l
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active November 4, 2024 16:50
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@jojobyte
jojobyte / ContextCmder-Disable.reg
Last active November 5, 2024 02:36
Cmder Context (Right-Click) Menu for Windows 7, 8, 10 & 11
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]
@davidfowl
davidfowl / dotnetlayout.md
Last active December 23, 2024 22:40
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@augustoproiete
augustoproiete / detectfx.cpp
Created November 29, 2016 00:00
Detect .NET Framework installed on the machine (Credits: Aaron Stebner, October 24, 2016)
#include <stdio.h>
#include <windows.h>
#include <tchar.h>
#include <strsafe.h>
#include <mscoree.h>
// In case the machine this is compiled on does not have the most recent platform SDK
// with these values defined, define them here
#ifndef SM_TABLETPC
#define SM_TABLETPC 86
# output all the colour combinations for text/background
# https://stackoverflow.com/questions/20541456/list-of-all-colors-available-for-powershell/41954792#41954792
$colors = [enum]::GetValues([System.ConsoleColor])
Foreach ($bgcolor in $colors){
Foreach ($fgcolor in $colors) { Write-Host "$fgcolor|" -ForegroundColor $fgcolor -BackgroundColor $bgcolor -NoNewLine }
Write-Host " on $bgcolor"
}
@BennieCopeland
BennieCopeland / AggregateNotFoundException.cs
Last active January 15, 2018 04:48
Basic domain objects
using System;
/// <summary>
/// The exception is thrown when the requested aggregate is not found by the <see cref="IEventStore"/> implementation.
/// </summary>
public class AggregateNotFoundException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="AggregateNotFoundException"/> class.
/// </summary>
@treymack
treymack / readme.md
Last active October 29, 2022 11:07
DbUp Migration Strategy

Motivation

There were a couple of issues we encountered over the years using FluentMigrator.

Order of Migrations not easily visible

The ordering of Migrations in FM depended on an Attribute on the Migration class, taking a long to use when sorting. By convention, this was to represent a timestamp at a particular precision (yyyyMMddhhmm), but that wasn't always followed. Additionally, we got out of sync on the precision to use. Since this was represented as a long, 20150102120059 would be sorted after 201501011200, which wasn't the intent.

Changes to Stored Procs / Functions / Views not easily visible

@kafene
kafene / gpg-wkd.md
Last active December 6, 2024 07:12
Setting up WKD for self-hosted automatic key discovery

I just got this working so I figured I'd share what I found, since there's hardly any information about this anywhere online except an RFC, the GPG mailing list and one tutorial from the GnuPG blog.

You can use automatic key discovery with WKD (Web key directory) to make it easy for users to import your key, in GPG since version 2.1.12. Since this feature is fairly new, it isn't yet available in the current LTS release of Ubuntu (16.04; xenial), however it is available in Debian stable (stretch).

I couldn't add a DNS CERT or DANE / OPENPGPKEY record through my email service (which also hosts my nameservers). I tried making the PKA record - a foo._pka.example.com TXT record but GPG doesn't seem to recognize it and fails; I'm still investigating why.

So the last option for self-hosted auto-discovery was WKD.

First thing I had to do was add an email address to my key. My primary UID is just my name so the key represents my identity rather

@alanstevens
alanstevens / Windows11_Setup.md
Last active December 8, 2024 22:30
Windows 11 Setup

This guide was created using Microsoft Windows 11 Pro

Version 21H2 build 22000.194

Installation

System Updates:

  • Settings -> Windows Update
  • Install all updates

Powershell Execution Policy:

  • launch Windows Powershell as administrator and execute: