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 / 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
@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 / 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
using System.Collections.Generic;
using System.Linq;
using System.Collections.ObjectModel;
namespace TestAutoMapper
{
class Program
{
static void Main(string[] args)
{
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
@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"
}));
@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
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\15.0\OneNote\Options\Other]
"ScreenClippingShortcutKey"=dword:00000059
@cezarypiatek
cezarypiatek / ProducerConsumer.cs
Created August 30, 2017 19:44
Producer with single thread consumer
public class ProducerConsumer<T>
{
readonly BlockingCollection<T> dataToProcess = new BlockingCollection<T>();
private readonly Thread workerThread;
public ProducerConsumer(Action<T> action)
{
workerThread = new Thread(() =>
{
foreach (var data in dataToProcess.GetConsumingEnumerable())
@cezarypiatek
cezarypiatek / xx.ps1
Created August 29, 2017 13:47
Remove WebActivatorEx from all projects
function Uninstall-WebActivatorEx{
Get-Project -All |% {Uninstall-Package WebActivatorEx -Force -ProjectName $_.ProjectName}
}