Skip to content

Instantly share code, notes, and snippets.

View SeanFeldman's full-sized avatar

Sean Feldman SeanFeldman

View GitHub Profile
@SeanFeldman
SeanFeldman / LuhnNumberGenerator.cs
Created April 8, 2026 17:48
Luhn Number Generator
// dotnet run LuhnNumberGenerator.cs
using System;
const int DesiredLength = 11; // Change this to generate different lengths
const int NumberToGenerate = 1; // How many numbers to generate
if (DesiredLength < 2)
{
Console.WriteLine("Error: Length must be at least 2 (1 digit + 1 check digit).");
@SeanFeldman
SeanFeldman / CancellationTimeoutBehavior.cs
Created February 9, 2021 05:53 — forked from ramonsmits/CancellationTimeoutBehavior.cs
NServiceBus 7 behavior that adds a cancellation token to the context which can be retrieved by handler
//
// NServiceBus v8 will have improved support for cooperative cancellation.
//
// Register behavior:
//
// endpointConfiguration.Pipeline.Register(new CancellationTimeoutBehavior(TimeSpan.FromSeconds(5)), nameof(CancellationTimeoutBehavior));
//
using System;
using System.Threading;
using System.Threading.Tasks;
@SeanFeldman
SeanFeldman / pr.md
Created December 15, 2016 17:15 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: