Skip to content

Instantly share code, notes, and snippets.

View attentive's full-sized avatar

Tom attentive

View GitHub Profile

This does turn out to be quite annoying.

I have just spent some time fossicking through all the various answers to this and have found a combination of things that is working for me nicely on Mac OS Ventura.

How to get a real Compose key on OS X Ventura

1. Install the so-called "U.S. Custom" keyboard layout

This is just a "playground" custom keyboard layout for doing exactly what we're going to do, namely setting up a typical Linux style Compose key for an English keyboard.

@attentive
attentive / README.md
Last active February 6, 2024 14:00
Using tsconfig "paths" path aliases with Angular and tsc-alias

Getting tsconfig "paths" path aliases to work with Angular using tsc-alias

If you look around you'll find quite a few people complaining that Angular CLI doesn't work "out of the box" with path aliases for the TypeScript compiler.

Fortunately the handy tool tsc-alias will run the rule over your compiled output and replace the still-present path aliases from your dev codebase with correctly resolved relative paths.

This tool mostly works correctly out of the box, but there are a couple of frustrating gotchas:

  1. Angular sets up custom tsconfig.json files everywhere (eg tsconfig.lib.json). Tools such as ESLint etc don't love this practice and the TypeScript compiler itself doesn't recognise these files or apply their "paths" aliases correctly.
@attentive
attentive / Combine.cs
Last active March 16, 2024 03:54
Path.Combine doesn't work correctly. Here's an alternative function that works a bit better and accepts variadic arguments.
public static class Paths
{
/// <summary>
/// Combine up to 1,000 filesystem paths in a way that you'd hope works better than Path.Combine, which it turns out
/// doesn't work properly.
/// </summary>
/// <param name="paths">A non-null, non-empty array of non-empty, non-whitespace input paths to join together (properly)</param>
/// <returns>A combined path</returns>
public static string Combine(params string[] paths)
{
@attentive
attentive / GdalReadVirtualFile.cs
Created April 30, 2024 08:39
Read the raw data from a GDAL VSI file in C#
/// <summary>
/// On various GDAL mailing lists and forums one can find people complaining about the lack of the VSIFReadL
/// function in GDAL's C# bindings, which allows data to be read from a GDAL "virtual file".
///
/// An example is here: https://lists.osgeo.org/pipermail/gdal-dev/2018-July/048838.html
///
/// However it is possible to use .NET Platform Invoke as below to call this function straight from the native
/// GDAL DLL entry point.
/// </summary>
internal static class GdalReadVsiFile