Skip to content

Instantly share code, notes, and snippets.

View bh3605's full-sized avatar

Bryson Hair bh3605

View GitHub Profile
@bh3605
bh3605 / SendDBEmailwithTabularQuery.sql
Created April 28, 2021 12:54
Sends an email when results are returned from a query
-- =============================================
-- Author: Hair, Bryson
-- Create date: 4/27/2021
-- Description: This stored procedure will send an email from the database with the query results as an html table in the email.
-- =============================================
ALTER PROCEDURE [dbo].[CFT_SendDBEmailwithTabularQuery]
(
@qSELECT NVARCHAR(100), --The select part of the sql statement, which can include top X
@fieldlist NVARCHAR(MAX), --Pipe delimited list of fields, which can include aliases
@qFROM NVARCHAR(MAX), --The from part of the sql statment, which can include joins
@bh3605
bh3605 / Fingerprint.cs
Created January 28, 2022 02:23
Webforms Cache Buster
sing System.Collections.Concurrent;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Web;
/**
* Solution from https://stefanolsen.com/posts/cache-busting-with-asp-net-mvc/
* https://www.madskristensen.net/blog/cache-busting-in-aspnet/
* https://stefanolsen.com/posts/cache-busting-2-0-an-update-for-asp-net-core/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
public class TypeSafeEnum<T> where T : class
{
TypeSafeEnum(string name, T typeSafeEnum)
{
@bh3605
bh3605 / cmd
Created March 15, 2023 19:44
Delete everything quickly and quietly on Windows
DEL /F/Q/S *.* > NUL
@bh3605
bh3605 / AspireNServiceBusExamples.cs
Created August 8, 2025 02:56
Azurite local ASB testing
// File: AspireNServiceBusExamples.cs
// This file contains sample code snippets demonstrating:
// 1) Using Azurite to emulate Azure Storage Queues locally
// 2) Configuring NServiceBus for local Azurite Storage Queues transport
// 3) Configuring NServiceBus for production Azure Service Bus transport
//
// Note:
// - Azurite is a local Azure Storage emulator you run via npm:
// npm install -g azurite
// azurite --queue
@bh3605
bh3605 / waitForSignal.ts
Last active February 28, 2026 06:36
Promise-based utility that waits for signal readiness, supporting non-null checks or custom type-guard predicates with proper overload inference.
/**
* Converts an Angular signal getter into a Promise that resolves once a
* nonnull value is emitted. Internally creates an effect and
* automatically destroys it after resolution to prevent memory leaks.
*
* @param source A function that returns the current value of a signal.
* @returns A Promise that resolves with the first value the signal emits that isn't null
*/
export function waitForSignal<T>(source: () => T): Promise<NonNullable<T>>;