Skip to content

Instantly share code, notes, and snippets.

View tmakin's full-sized avatar

Tom Makin tmakin

  • Vertical Aerospace
  • Shepton Mallet, UK
View GitHub Profile
@tmakin
tmakin / HtmlToPdfAws.csproj
Last active December 20, 2023 08:38
c# Html to Pdf on AWS Lambda using AspNetCore
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>HtmlToPdfAws</AssemblyName>
<Rootnamespace>HtmlToPdfAws</Rootnamespace>
</PropertyGroup>
<ItemGroup>
<!-- native assets excluded as we are using lambda layers instead -->
@tmakin
tmakin / machine.js
Created November 9, 2020 12:26
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@tmakin
tmakin / RhinoTextBugReport.cs
Last active July 29, 2020 07:41
Rhino Text Generation Bug
/// <summary>
/// Repro for intermittent failure of TextEntity.CreateExtrusions
/// The issue also affects TextEntity.CreateSurfaces
///
/// Expected Output:
/// - "ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789" rendered on every line
///
/// Actual Output:
/// - About 50% of the lines are truncated abd only print part of the string because the generated extrusion is null.
/// e.g. "ABCDEFGHIJ"
@tmakin
tmakin / ExportPdf.cs
Last active October 24, 2024 21:21
Create PDF Rendering service in Azure Functions
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using DinkToPdf;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
using IPdfConverter = DinkToPdf.Contracts.IConverter;
//Source: https://codeblog.jonskeet.uk/2011/08/22/optimization-and-generics-part-1-the-new-constraint/
using System;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
#pragma warning disable 0169
public class SmallClass { int x; }