Skip to content

Instantly share code, notes, and snippets.

View cezarypiatek's full-sized avatar
🎹
Coding

Cezary Piątek cezarypiatek

🎹
Coding
View GitHub Profile
@cezarypiatek
cezarypiatek / gist:6d8e7dae18f568b8d5f7e9fcf543fb6c
Created January 26, 2018 21:45 — forked from SzymonPobiega/gist:5220595
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@cezarypiatek
cezarypiatek / Example.cs
Last active October 22, 2023 16:33
Example provider for Swashbuckle
services.AddSwaggerGen(c =>
{
c.UseExampleFilter(e =>
{
e.DefineExample<AuthenticationController>(con => con.Login(new LoginCredentials
{
Login = "cezarypiatek",
Password = "secret"
}));
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Syntax.SyntaxReplacer.NodeListEditor.Visit(Microsoft.CodeAnalysis.SyntaxNode node = AssignmentExpressionSyntax SimpleAssignmentExpression b.CorrespondenceAddresses = a.CorrespondenceAddresses) Unknown No symbols loaded.
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitExpressionStatement(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionStatementSyntax node = ExpressionStatementSyntax ExpressionStatement b.CorrespondenceAddresses = a.CorrespondenceAddresses;) Unknown No symbols loaded.
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionStatementSyntax.Accept<Microsoft.CodeAnalysis.SyntaxNode>(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor<Microsoft.CodeAnalysis.SyntaxNode> visitor = {Microsoft.CodeAnalysis.CSharp.Syntax.SyntaxReplacer.NodeListEditor}) Unknown No symbols loaded.
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit(M
using System.Collections.Generic;
using System.Linq;
using System.Collections.ObjectModel;
namespace TestAutoMapper
{
class Program
{
static void Main(string[] args)
{
@cezarypiatek
cezarypiatek / ProjectOrphanScouter.ps1
Last active February 12, 2019 20:17
Script for detecting orphaned files in C# projects
function Search-ItemsRecursive{
[CmdletBinding()]
param($ProjectItems, $Filter, [switch]$Recurse=$false)
foreach ($item in $ProjectItems) {
if($(. $Filter $item))
{
$item
}
if(($item.ProjectItems -ne $null) -and $Recurse){
Search-ItemsRecursive -ProjectItems $item.ProjectItems -Filter $Filter -Recurse:$Recurse
@cezarypiatek
cezarypiatek / App.config
Created April 23, 2019 09:43
External binding redirect
</configuration>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<linkedConfiguration href="file:AssemblyBinding.xml"/>
</assemblyBinding>
</configuration>
@cezarypiatek
cezarypiatek / FetchAllNullableRules.cs
Created October 8, 2019 15:05
A sample application to retrieve all diagnostics related to the nullability
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Threading;
using Microsoft.CodeAnalysis.Diagnostics;
namespace TestNonNullableReferences
{
class Program
<transformations>
<apps>
<app name="SampleApp1">
<templates>
<template name="appsettings.json" input="appsettings.json.template" />
<template output="nlog.config" input="nlog.config.template" />
</templates>
</app>
<app name="SampleApp2">
<templates>
FROM mcr.microsoft.com/dotnet/core/sdk:3.1
RUN echo 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_10/ /' > /etc/apt/sources.list.d/network:messaging:zeromq:release-stable.list \
&& wget -nv https://download.opensuse.org/repositories/network:messaging:zeromq:release-stable/Debian_10/Release.key -O Release.key \
&& apt-key add - < Release.key \
RUN apt-get -y update \
&& apt-get -y install libzmq3-dev \
&& dpkg -L libzmq3-dev
private static ITypeSymbol GetRangeVariableType(SemanticModel semanticModel, IRangeVariableSymbol symbol)
{
ITypeSymbol type = null;
if (!symbol.Locations.IsEmpty)
{
var location = symbol.Locations.First();
if (location.IsInSource && location.SourceTree == semanticModel.SyntaxTree)
{
var token = location.SourceTree.GetRoot().FindToken(symbol.Locations.First().SourceSpan.Start);