Skip to content

Instantly share code, notes, and snippets.

View costr's full-sized avatar
📈

Adam Costenbader costr

📈
View GitHub Profile
@costr
costr / gist:f1f85dd25250adede7f902c5a00a5733
Created November 7, 2023 16:41
EF DbContext Console Logging Query
myDBContext.Database.Log = message => System.Diagnostics.Debug.WriteLine(message);
@costr
costr / Result.cs
Created July 20, 2023 13:43
Result Pattern Class
public class Result<T>
{
private readonly T _value;
public T Value { get { return _value; } }
private List<string> _errors = new List<string>();
public IReadOnlyCollection<string> Errors => _errors;
private List<Exception> _exceptions = new List<Exception>();
public IReadOnlyCollection<Exception> Exceptions => _exceptions;
@costr
costr / TokenGenerationTable.Example.sql
Last active June 17, 2022 22:38
Creating Unique Token At Table Level
CREATE TABLE [dbo].[tokens]
(
[id] INT IDENTITY(1,1) NOT NULL,
[token] NCHAR(6) NOT NULL CONSTRAINT DF_subscribertokens_token DEFAULT CONVERT(nvarchar(6),LEFT(REPLACE(NEWID(),'-',''),6)),
[created] DATETIME NOT NULL CONSTRAINT DF_subscribertokens_created DEFAULT getutcdate(),
[notes] VARCHAR(MAX) NULL,
[deactivated] BIT NOT NULL CONSTRAINT DF_subscribertokens_deactivated DEFAULT 0,
CONSTRAINT [PK_tokens] PRIMARY KEY CLUSTERED ([id] ASC),
CONSTRAINT UC_tokens_token UNIQUE (token)
@costr
costr / BaseTestMethodSnippet.snippet
Last active November 15, 2021 05:11
Test Method Snippet
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Test Method - Base</Title>
<Author>Adam Costenbader</Author>
<Description>Use to define the base structure of a test method.</Description>
<Shortcut>btest</Shortcut>
</Header>
<Snippet>
@costr
costr / Resume.md
Last active October 7, 2021 15:18
Adam Costenbader's Resume Gist

Objective

To grow as a software architect, developer, team member, and leader, in a challenging and caring environment


Work Experience

KEYHOLE SOFTWARE INC. – Kansas City, KS (Remote)

TEAM LEAD / CONSULTANT / FULL-STACK DEVELOPER       August 2016 - Present

@costr
costr / FindSqlTableByColumnName.sql
Last active May 3, 2021 15:46
Find SQL Table by Column Name
SELECT
COLUMN_NAME AS 'ColumnName'
,TABLE_SCHEMA AS 'TableSchema'
,TABLE_NAME AS 'TableName'
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
COLUMN_NAME LIKE '%COLUMN_NAME_HERE%' -- <-- REPLACE COLUMN FILTER
ORDER BY
TableSchema
@costr
costr / ExecutionTimeLogger.cs
Last active July 8, 2021 21:02
Execution time logging in C# with usings
using System;
using System.Diagnostics;
namespace Tools.Debugging
{
public class ExecutionTimeLogger : IDisposable
{
private readonly Stopwatch watch;
private readonly string _titleForWhatIsBeingTracked;
private readonly string _callingMethodName;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Home School Schedule

8:30 - Breakfast

9:00 - Specials Video on Fridays

9:30 - Short Movement Time (Go Noodle or yoga)

9:45 - Morning Announcements

@costr
costr / ___readme.md
Last active January 8, 2020 14:55
Slack Slash Command Issuing From Home Assistant

The Problem

I am in multiple Slack teams and have messages coming in frequently throughout the day. I am also on phone calls with clients all day who don't want to feel like I'm distracted during the call. I could put myself DND (do not disturb) on each slack instance but that's time consuming and I cannot always predict when I'll have a call.

My Current Solution

I found a brilliant Slack app, called "OTTT", that allows you to issue slash commands to set your DND for a specified amount of time. To make this more awesome it also allows you, for a modest service fee, to link your Slack team instances so that one slash command sets all of your workspaces to DND. [u]This is what I need![/u]

Now with use of the Ariela app call state sensor and the Slack notify component, with a few small tweaks, I can auto DND when I'm on a call....ah, sweet silence.