Skip to content

Instantly share code, notes, and snippets.

View mamidenn's full-sized avatar
♥️
In love with SvelteKit

Martin Dennhardt mamidenn

♥️
In love with SvelteKit
View GitHub Profile
@mamidenn
mamidenn / Middleware.cs
Created August 13, 2023 08:08
Skipping Middleware for steps like `If`, `While`, etc. prevents unnecessary operations
public class Middleware : IWorkflowStepMiddleware
{
public async Task<ExecutionResult> HandleAsync(IStepExecutionContext context, IStepBody body, WorkflowStepDelegate next)
{
if (body is ContainerStepBody) return await next();
Debug.WriteLine($"Start: {context.Step.Name ?? body.GetType().Name}");
var result = await next();
Debug.WriteLine($"End: {context.Step.Name ?? body.GetType().Name}");
return result;
}
@mamidenn
mamidenn / Import-LocalModule.ps1
Created March 16, 2020 10:25
Import PowerShell module without polluting environment
$name = psake
Save-Module -Name $name -Path .
Import-Module -Name .\$name
! special
*.foreground: #a7a7a7
*.background: #1e1e1e
*.cursorColor: #a7a7a7
! black
*.color0: #1e1e1e
*.color8: #5f5a60
! red
@mamidenn
mamidenn / DropIndicator.cs
Created July 6, 2017 11:59
A ListView with rearrangeable items. Uses a DropIndicator object to provide visual clues as to where a dragged item will be dropped.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
namespace de.dennhardt
@mamidenn
mamidenn / SelectionRectangle.cs
Last active June 15, 2017 19:05
A simple wrapper for System.Drawing.Rectangle that allows manipulation of the Top, Right, Bottom and Left properties.
public class SelectionRectangle : IEquatable<SelectionRectangle>
{
private Rectangle rectangle;
public int Area
{
get { return rectangle.Width * rectangle.Height; }
}
public int X
{