Skip to content

Instantly share code, notes, and snippets.

View mhagrelius's full-sized avatar

Matthew Hagrelius mhagrelius

  • Rockford, MI, USA
  • 06:22 (UTC -04:00)
View GitHub Profile
@mhagrelius
mhagrelius / code-check.sh
Created September 26, 2019 01:06
Test for adherence to clean architecture guidelines
#!/bin/bash
RESULT=$(grep -r -i --include \*.cs --include \*.cshtml --exclude Startup.cs --exclude /bin/\* --exclude /obj/\* --exclude /Configuration/\*.cs "Infrastructure.Namespace.Here" FolderNameHere)
if [ -z "$RESULT" ]
then
echo $RESULT
exit 1
fi
echo "No issues found."
exit 0
@mhagrelius
mhagrelius / example.cs
Last active September 25, 2019 18:41
Retrieve Groups From Microsoft Graph
/*
Uses Flurl.Http instead of default http client
Your app registration will need the appropriate permissions for microsoft graph
*** Additional exception handling needed if in a production scenario ***
*/
public static class Program
{
public async Task Main()
@mhagrelius
mhagrelius / RoleClaimsTransformation.cs
Last active September 26, 2019 00:55
Workaround for Azure AD groups and Asp.Net Core Roles
namespace Example
{
public class RoleClaimsTransformation : IClaimsTransformation
{
public Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
{
var identity = principal.Identities?.FirstOrDefault();
if (identity == null)
{
return null;
@mhagrelius
mhagrelius / 1-setup.md
Created September 25, 2019 15:16 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing with either GPG or Krypt.co.