Skip to content

Instantly share code, notes, and snippets.

View franklin-ross's full-sized avatar

Franklin Ross franklin-ross

View GitHub Profile
@franklin-ross
franklin-ross / ThenGroupBy.cs
Last active May 18, 2020 09:14
ThenGroupBy(): Simplify nested GroupBy's in C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Extension functions for creating nested groupings, similar to
/// <see cref="System.Linq.Enumerable.ThenBy" />.
/// </summary>
public static class ThenGroupByExtensions
@franklin-ross
franklin-ross / .gitconfig
Last active September 10, 2024 08:20
My git aliases
# Merge this into ~/.gitconfig
# GIT_TRACE=1 environment variable makes git print traces of it's operations
[alias]
# Undo recent commits without changing any files.
# Go back 1 commit: `git uncommit`
# Undo the last 3 commits: `git uncommit 3`
uncommit = "!f() { git reset --soft \"HEAD~${1:-1}\"; }; f"
# Deletes remote tracking branches which have been deleted on the remotes.
@franklin-ross
franklin-ross / Order insignificant sequence comparer.cs
Last active May 18, 2020 09:11
Stand alone extension to Stephen Cleary's Comparers library, which adds the option to make order insensitive sequence comparers from single element comparers.
/// <summary>Defines the significance of element ordering for a sequence comparer.
/// </summary>
public enum ElementOrder
{
/// <summary>Relative order of elements is significant.</summary>
Significant,
/// <summary>Relative order of elements is not significant.</summary>
NotSignificant
}