Skip to content

Instantly share code, notes, and snippets.

@flew2bits
flew2bits / OptimizedOrderTablesWithAutoColumn.cs
Last active August 25, 2023 13:09
QuestPDF pre-calculated column width based on content.
using QuestPDF.Elements;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
public class OrderItem
{
public string ItemName { get; set; } = Placeholders.Sentence();
public int Price { get; set; } = Placeholders.Random.Next(1, 11) * 10;
public int Count { get; set; } = Placeholders.Random.Next(1, 11);
@flew2bits
flew2bits / FillAbove.cs
Created March 10, 2023 22:50
QuestPDF sample Dynamic Component to use available space aboce
using QuestPDF.Elements;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
using QuestPDF.Previewer;
using SkiaSharp;
Document.Create(doc =>
{
doc.Page(page =>
@flew2bits
flew2bits / UpdatedSample.cs
Created March 11, 2023 00:30
Updated Sample for vertical fill
using QuestPDF.Elements;
using QuestPDF.Infrastructure;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Previewer;
Document.Create(doc =>
{
doc.Page(page =>
{
@flew2bits
flew2bits / MarkdownComponent.cs
Created March 11, 2023 18:45
Initial implementation of Markdown Component for QuestPDF
using Markdig;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
namespace PdfExperiments;
public record MarkdownBlockStyle(Func<IContainer, IContainer>? ItemStyle,
@flew2bits
flew2bits / QuestPDFMarkdownSample.cs
Created March 11, 2023 18:48
Sample of Markdown component for QuestPDF
using PdfExperiments;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Previewer;
Document.Create(doc =>
{
doc.Page(page =>
{
page.Size(PageSizes.Letter);
@flew2bits
flew2bits / MarkdownComponent.cs
Created March 12, 2023 14:27
Updated Markdown component for QuestPDF
using Markdig;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
namespace PdfExperiments;
public enum BlockType
@flew2bits
flew2bits / FillSpace.cs
Created March 31, 2023 12:50
Width filling component
public class FillSpace : IDynamicComponent<int>
{
private readonly Func<TextSpanDescriptor, TextSpanDescriptor> _styler;
private readonly char _delimiter;
public FillSpace(Func<TextSpanDescriptor, TextSpanDescriptor> styler, char delimiter = '.')
{
_styler = styler;
_delimiter = delimiter;
}
@flew2bits
flew2bits / Program.cs
Last active January 29, 2024 16:37
Sample Repro demonstrating issue with saga ids
using Marten;
using Oakton;
using Wolverine;
using Wolverine.Http;
using Wolverine.Marten;
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseWolverine();
builder.Host.ApplyOaktonExtensions();
@flew2bits
flew2bits / Repro.cs
Last active February 3, 2024 00:54
Repro for Marten 7 beta 5 regression
using Marten;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Wolverine;
var builder = Host.CreateDefaultBuilder();
builder.UseWolverine();
@flew2bits
flew2bits / MartenFanoutBug.cs
Created February 23, 2024 13:27
Repro demonstrating possible inline fanout bug
using Marten;
using Marten.Events.Daemon.Resiliency;
using Marten.Events.Projections;
using Marten.Schema;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = Host.CreateApplicationBuilder();
builder.Services.AddMarten(opts =>