Referencing Blazorise Theme Values in Custom CSS

A header image displaying two different div elements with two differently coloured shadows

Introduction

Blazorise is an excellent library that I’ve been using a lot lately. While it has great support for declaring custom visual themes, you’ll occasionally run into situations where what you’re trying to do isn’t fully supported.

Take this super contrived example: I want to set the shadow on a div to use the primary colour defined in my theme, but there’s no attribute in Blazorise to do this directly (at time of writing). I could hard-code the colour to the same hex value as what I’ve set in my theme, but not only is this generally bad practice (since it’s easy to update one value and not the other), it locks you into only one colour even though the theme can be modified dynamically during runtime. So how can we access our Blazorise theme values in custom CSS?

Continue reading “Referencing Blazorise Theme Values in Custom CSS”

Migrating ASP.NET Core Development Secrets out of appsettings.json

A banner showing an appsettings file filled with fake secrets transforming into one with blank secrets

I’m sure I’m not the only one that has “temporarily” stored passwords, application keys or other development secrets in appsettings.json simply because it was easier or faster than doing it the right way (although if I am, this first sentence will surely come back to haunt me).

I get it. It happens! This blog post actually comes from my efforts to update a project I’m working on with some friends so that we’ve got a more consistent approach to keeping secrets… secret.

So how are we going to go about this? We’ll be using Secret Manager, a fantastically helpful tool built into the configuration API in ASP.NET Core that will let us keep the secrets out of appsettings while not require a change to how we access the settings in code. Sound good?

Continue reading “Migrating ASP.NET Core Development Secrets out of appsettings.json”

Regular Expression Tips for People That Hate Regular Expressions

A screenshot of a code editor. There are three lines, setting the variables "isCustomerNumber", "isProductNumber" and "isTransactionNumber" based on whether a series of regular expression (regex) matches succeed

I’ve been writing regular expressions (regex) for years and would consider myself pretty good at them by now (I decline to provide references). The problem is that although it’s common to see regex as cryptic and painfully terse (which are not invalid points), they remain one of the best ways to handle complex pattern matching and as such you’ll probably run into them at least a few times in your career.

Even if you really despise writing regular expressions, here are some tips that will help to make that process as painless as possible!

Continue reading “Regular Expression Tips for People That Hate Regular Expressions”