Skip to content

Instantly share code, notes, and snippets.

View bc3tech's full-sized avatar

Brandon H bc3tech

View GitHub Profile
@bc3tech
bc3tech / ConfigureNamedOptions.cs
Last active September 24, 2024 16:26
Helpful classes for C# projects
/// <summary>
/// Created to handle *named* configuration
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>
/// Registers a type that will have all of its <see cref="IConfigureOptions{TOptions}"/>,
/// <see cref="IPostConfigureOptions{TOptions}"/>, and <see cref="IValidateOptions{TOptions}"/>
/// registered.
/// </summary>

Keybase proof

I hereby claim:

  • I am bc3tech on github.
  • I am bc3tech (https://keybase.io/bc3tech) on keybase.
  • I have a public key ASCSTWD7wwesrmgFZ7Ll25M2_poVYMb9NL2g_yECZytX2wo

To claim this, I am signing this object:

@bc3tech
bc3tech / profiles.json
Created November 13, 2019 00:42
Terminal profiles
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles": [
@bc3tech
bc3tech / BusyButton.xaml
Last active February 14, 2020 08:27
A XAML Button control that incorporates a "Busy" state w/ progress ring while its Command executes
<UserControl x:Class="App.Controls.BusyButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400"
HorizontalContentAlignment="Stretch"
@bc3tech
bc3tech / BandDimensions.cs
Created December 16, 2015 05:33
Microsoft Band Dimensions factory
using Microsoft.Band;
using Windows.UI.Xaml.Media.Imaging;
namespace App
{
enum BandType
{
Band1,
Band2
}
@bc3tech
bc3tech / combineNotifications.cs
Last active October 5, 2015 16:18
Combine multiple notification XMLs in to one payload for pinned tiles
using DomXmlDocument = Windows.Data.Xml.Dom.XmlDocument;
private static DomXmlDocument CombineNotifications(List<XDocument> notificationXmlsToReturn)
{
// Per https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868253.aspx#include_both_a_square_and_wide_notification_in_the_payload
// Make the 'binding' elements in each siblings in the new one
var notificationXmlDocument = notificationXmlsToReturn.FirstOrDefault()?.ToDomXmlDocument();
if (notificationXmlDocument != null)
{
var visualTag = notificationXmlDocument.GetElementsByTagName("visual").SingleOrDefault();
@bc3tech
bc3tech / propr.snippet
Last active September 29, 2015 15:05
VS 2015 C# 6.0 code snippet for read-only properties
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Keywords>
<Keyword>property prop propr 6</Keyword>
</Keywords>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
@bc3tech
bc3tech / enum-tryparse-parse-defined-only.cs
Last active August 29, 2015 14:23
Enum Defined/Parse/TryParse helpers
/// <summary>
/// Determines whether the instance is defined as a value for its enumeration
/// </summary>
/// <param name="input">The input.</param>
/// <returns></returns>
/// <example>
/// <code lang="c#">
/// enum MyEnum {
/// Value1 = 1,
/// }