Posts tagged as "snippet"

Feature Flags: Removing Unused Methods on Cleanup
3 min

Keep your codebase clean and organized with the FeatureFlagWillMakeThisObsolete annotation. Mark unused methods that can be safely deleted on feature flag cleanup a breeze. Say goodbye to clunky workarounds and technical debt

Read post ›
How to echo commands as they are executed in a shell script
1 min

It is helpful to log the shell commands being executed when running a bash script (especially when debugging it). Let see what commands we can use to log the commands

Read post ›
How to add estimated Reading Time to Posts in Statiq
1 min

A guide to creating a module to add estimated reading time as metadata for posts in websites created with Statiq

Read post ›
Fix the Language version error for Unity projects in Rider
1 min

How to fix the language version compiler error on building a project in rider created with Unity.

Read post ›
How to host a compressed Unity WebGL game on Netlify
2 min

In this article, I will be showing how to serve a unity game compressed with Brotli compression to Netlify

Read post ›
How to batch rename multiple files in subfolders in Windows
1 min

A single command to update the file extensions for files in all the subfolders using a single command in Windows command prompt

Read post ›
How to Serialize enums as strings in .Net Core
1 min

If you try to serialize an enum to Json using System.Text.Json in .Net Core, it converts it into an integer by default. This is not very readable. How can we have a more readable enum value in the JSON output?

Read post ›
How to set all bits of an enum flag in C#
1 min

Sometimes, we want to set all the bits on a flag. The easiest way to do this is by adding another value to the enum. But there is a more elegant way using LinQ which does not require updating the flag.

Read post ›
How to replace a word in a string in C#
1 min

There is no way to replace just whole words using string.Replace. Let's see how we can replace whole words in string using Regex

Read post ›
How to programmatically unregister a service worker
1 min

Sometimes you just want to remove a service worker either because something is wrong with it or you don't need it anymore. Lets see how we can do it programmatically

Read post ›
How to calculate reading time
1 min

A guide to calculating the reading time for a given document

Read post ›
How to Upload Multiple Files to AWS S3 using Terraform
1 min

A snippet to upload multiples files from a specific folder (recursively) to AWS S3 using terraform

Read post ›
How to replace a pipeline in Statiq
1 min

A guide to replacing a pipeline in Statiq

Read post ›
How to override the netlify build config
1 min

A way to override the netlify build settings so that we can override the build commands for a branch

Read post ›
How to run SQL Server in a Docker container
3 min

In this post, we will see how we can run SQL Server on Docker using docker-compose and managing the image and environment variables in a docker file

Read post ›
How to set up the project properties for Source Generators
2 min

A guide to setting up the project properties that we need to create and use source generators

Read post ›
How to reset the primary key sequence in Postgres
1 min

How can we fix the "duplicate key value violates unique constraint" error because the primary key sequence is out of sync from the records in the table

Read post ›
How do you upload a PDF received from an API to AWS S3?
1 min

A code snippet to encrypt and upload a PDF file to an AWS S3 bucket received as a Stream from an external API

Read post ›
How to stop and remove all Docker containers
1 min

Occasionally, I have needed to stop and remove all the docker containers I am running locally. Let's see how we can do it easily.

Read post ›
How to get TimeZoneInfo on Windows and Linux
1 min

Lets see how we can get the TimeZoneInfo regardless of whether the code is running on Windows or Linux

Read post ›
How to use ApprovalTests with xUnit's Theory attribute
1 min

The approval test filename for Theory-based tests is not unique by default. How can we get generate unique filenames for theory-based approval tests.

Read post ›
Dapper and NPGSql : Write a query with the IN operator
1 min

In this post, I look at what changes need to be made to write a query with the IN operator in a WHERE clause using Dapper and NPGSql

Read post ›
How to prevent the compiler from copying an object in cpp
1 min

In this C++ tutorial, we see an easy way to prevent the compiler from making objects, i.e. non-copyable objects.

Read post ›
A guide to finding memory leaks using macros in C++
2 min

Macro trickery to find the offending file(s) and line(s) causing Memory Leak(s) without using a commercial program.

Read post ›
How to start using Dynamic-link libraries (DLL)
1 min

This post deals with the basic information you need to know to begin using DLL's.

Read post ›