Skip to content

Instantly share code, notes, and snippets.

View tstepanski's full-sized avatar

Timothy M. Stepanski tstepanski

View GitHub Profile
@tstepanski
tstepanski / CMakeLists.txt
Created July 9, 2025 01:07
Erwin School Work
cmake_minimum_required(VERSION 3.31)
project(erwin_school_work)
set(CMAKE_CXX_STANDARD 23)
add_executable(erwin_school_work main.cpp)
@tstepanski
tstepanski / ReferenceLookup.cs
Created June 16, 2025 02:23
Demonstration of Reference Lookup and TryParse Abstraction in Modern C# Leveraging "static abstract"
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
interface ILookup<out T>
{
// For more information, read the docs here: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/interface#static-abstract-and-virtual-members
static abstract IEnumerable<T> GetAll();
}
@tstepanski
tstepanski / Program.cs
Created June 5, 2025 16:06
Semaphore Demonstration
const int countOfWorkersToRunInParallel = 3;
const int countOfWorkersToRunConcurrently = 12;
var cancellationTokenSource = new CancellationTokenSource();
var cancellationToken = cancellationTokenSource.Token;
var semaphore = new SemaphoreSlim(countOfWorkersToRunInParallel);
_ = Task.Run(async () =>
{
await Console.In.ReadLineAsync(cancellationToken);
@tstepanski
tstepanski / MessageDebounceSimulation.cs
Created December 1, 2023 01:32
Message Debounce Simulation
using System.Collections.Concurrent;
using System.Text.Json;
using System.Text.Json.Serialization;
var messageService = new MessageService();
var noisyThings = new NoisyThings(messageService);
var cancellationTokenSource = new CancellationTokenSource(Constants.RunSimulationFor);
var runningTasks = noisyThings
.GetNoisyThings()
.idea
.dockerignore
Dockerfile
**/obj/
**/bin/
@tstepanski
tstepanski / Boulders.java
Created December 7, 2021 04:16
Strategy Swapping
public class JavaFiddle
{
public static void main(String[] args)
{
BoulderMenu menu = new BoulderMenu(2, 4);
menu.showMenu();
System.out.println("now....");
@tstepanski
tstepanski / JoeEncoder.cs
Created May 1, 2020 20:14
Encode Tight Keys
using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
namespace JoeEncoder
{
@tstepanski
tstepanski / BinaryCalculatorTests.cs
Last active January 30, 2020 01:21
Calculates the longest Binary Gap in an positive 32-bit integer value using a bit shifting technique
using System.Diagnostics;
using Xunit;
using Xunit.Abstractions;
namespace Tests
{
public sealed class CalculatorTests
{
private readonly ITestOutputHelper _testOutputHelper;
public class Example
{
public static void main(String[] args)
{
double twoFiftyInTheAfternoonUTC = 14.5d;
double acstTimeZoneOffset = 9.3;
double twoFiftyInTheAfternoonUTCInACST = add(twoFiftyInTheAfternoonUTC, acstTimeZoneOffset);
System.out.print(twoFiftyInTheAfternoonUTCInACST);
}
@tstepanski
tstepanski / main.c
Created September 5, 2019 14:32
Circle Bounding Box
#include <stdio.h>
#include <stdlib.h>
#include <zconf.h>
static const int MAX_INPUT_LENGTH = 30;
static const int MAX_CIRCLE_COUNT = 3;
struct Point {
long x;
long y;