Skip to content

Instantly share code, notes, and snippets.

@JohnLudlow
JohnLudlow / jl.omp.yaml
Last active December 15, 2023 14:43
Prompt config
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
"$schema": https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
palette:
left_header_bg: "#898989"
left_header_fg: "#000000"
path_bg: "#656565"
path_fg: "#dfdfdf"
@JohnLudlow
JohnLudlow / learningcsharp.md
Created January 8, 2021 09:46
A list of resources to aid in learning C#
@JohnLudlow
JohnLudlow / GetTfsWorkspace\GetTfsWorkspace.psm1
Last active May 12, 2017 22:36
Posh-git for TFS. Shows the workspace name, mapped server folder, changesets since you last did a get, and any pending checkouts. Also shows using the API from PowerShell
function Get-TfsWorkspace
{
# Script to find a Team Foundation workspace
[cmdletbinding()]
param(
[string] $workspaceHint = $pwd
)
begin
{
public static class AssertEx
{
public static void Throws<T>(Action action) where T : Exception
{
Exception actual = null;
try
{
action();
}
@JohnLudlow
JohnLudlow / Contract.cs
Last active January 15, 2016 16:15
Contracts
public static class Contract
{
public static void Requires(Expression<Func<bool>> assertion)
{
if(!assertion.Compile()())
{
throw new ContractRequirementException(string.Format("Expression {0} evaluated to false", assertion.ToString()));
}
}
public static class Extensions
{
public static TEnum AsEnum<TEnum>(this string input, Func<string, TEnum> func)
{
return func(input);
}
public static TEnum AsEnum<TEnum>(this string input)
{
return (TEnum)Enum.Parse(input, typeof(TEnum));