Skip to content

Instantly share code, notes, and snippets.

View sahgilbert's full-sized avatar

Simon Gilbert sahgilbert

View GitHub Profile
@miguelmota
miguelmota / process_names.txt
Last active March 4, 2024 22:20
macOS process whitelist
# not an exhaustive list
nsurlsessiond "icloud sync"
fseventsd "macos file system events"
WindowServer "macos windows"
DisplayLinkManager "macos driver"
configd "macos dynamic configuration"
displaypolicyd "macos process"
CommCenter "macos keychain"
kernel_task "macos kernel"
@sahgilbert
sahgilbert / UnifiedController.cs
Created June 3, 2019 20:50
C# ASP.Net Core - Unified MVC & Web Api Controller
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace SimonGilbert.Blog.Controllers
{
public class UnifiedController : Controller
{
[HttpGet]
public IActionResult Index()
{
@sahgilbert
sahgilbert / DateTimeExtensions.cs
Created May 22, 2019 13:48
DateTime Extension Methods - C# .Net Core
using System;
namespace SimonGilbert.Blog
{
public static class DateTimeExtensions
{
public static string ToRelativeDate(this DateTime dateTime)
{
var timeSpan = DateTime.Now - dateTime;
@sahgilbert
sahgilbert / NumericalExtensions.cs
Created May 22, 2019 13:37
Numerical Extension Methods - C# .Net Core
using System;
namespace SimonGilbert.Blog
{
public static class NumericalExtensions
{
public static double RoundByDecimalPlaces(this double number, int numberOfDecimalPlaces = 2)
{
return Math.Round(number, numberOfDecimalPlaces);
}