Skip to content

Instantly share code, notes, and snippets.

View simon-reynolds's full-sized avatar

Simon Reynolds simon-reynolds

View GitHub Profile
@simon-reynolds
simon-reynolds / ListToTree.cs
Created August 27, 2019 11:10 — forked from dmitry-pavlov/ListToTree.cs
Nice & universal way to convert List of items to Tree
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
namespace ListToTree
{
public class Category
{
@simon-reynolds
simon-reynolds / Fetch-All.ps1
Last active January 18, 2024 20:38
Powershell script to fetch changes in all repos in directory and pull changes if pristine on default branches
function Get-Changes {
Push-Location ".."
$branch= &git rev-parse --abbrev-ref HEAD
Write-Host "Current branch: " $branch
if ($defaultBranches -Contains $branch) {
if(git status --porcelain | Where-Object {$_ -match '^\?\?'}){

Keybase proof

I hereby claim:

  • I am simon-reynolds on github.
  • I am simontaite (https://keybase.io/simontaite) on keybase.
  • I have a public key ASDdaDEI0sgtlhtQObzvOjiTsdi4uHTfldN6pZAtTJrHtwo

To claim this, I am signing this object:

@simon-reynolds
simon-reynolds / GetPropertyName
Created November 16, 2013 11:11
Extension methods for getting name of property as a string
public static string GetPropertyName<T>(this T type, Expression<Func<T, object>> expression)
{
return GetPropertyName<T>(expression);
}
public static string GetPropertyName<T>(Expression<Func<T, object>> expression)
{
var lambda = expression as LambdaExpression;
MemberExpression memberExpression = lambda.Body is UnaryExpression