Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@DerLobi
DerLobi / pre-commit
Last active May 9, 2022 09:45
Don't commit focused tests. Use this as a pre-commit hook and the commit won't succeed if you have staged changes that contain `fdescribe`, `fcontext`, `fit`, `fspecify` or `fexample`. Copy this file as `pre-commit` into the `.git/hooks` folder of your repository (create it if neccessary) and chmod +x the file.
#!/bin/sh
#
# This pre-commit hook looks for `fdescribe`, `fcontext`, `fit`, `fspecify` and `fexample` in the
# staged files and exits with an error code of 1 if there are such changes.
#
STATUS=0
DESCRIBEFILES=$(git diff --staged -G"^\s*fdescribe\(" --name-only | wc -l)
if [ $DESCRIBEFILES -gt 0 ]
@jogleasonjr
jogleasonjr / SlackClient.cs
Last active October 20, 2023 15:54
A simple C# class to post messages to a Slack channel. You must have the Incoming WebHooks Integration enabled. This class uses the Newtonsoft Json.NET serializer available via NuGet. Scroll down for an example test method and a LinqPad snippet. Enjoy!
using Newtonsoft.Json;
using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;
//A simple C# class to post messages to a Slack channel
//Note: This class uses the Newtonsoft Json.NET serializer available via NuGet
public class SlackClient
{