Skip to content

Instantly share code, notes, and snippets.

View Antaris's full-sized avatar
🎯
Focusing

Matthew Abbott Antaris

🎯
Focusing
View GitHub Profile
@Antaris
Antaris / GitPruneBranches.ps1
Created February 27, 2024 22:13
Cleaning up local GIT branches with PowerShell
function GitPruneBranches {
param(
[string[]] $Exclude,
[switch] $Unmerged,
[switch] $Commit
)
$pattern = '^\s*(?!(master|main|develop|\*).*$).*'
if ($Exclude -and $Exclude.Count -gt 0) {
$pattern = '^(?!(master|main|develop|\*|' + (($Exclude -Join '|') -Replace '\*', '.*') + ').*$).*'
@Antaris
Antaris / ServiceProviderJobFactory.cs
Created May 21, 2019 19:57
A Quartz.NET job factory using Microsoft.Extensions.DependencyInjection and scoped services
using System;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Quartz;
using Quartz.Spi;
public class ServiceProviderJobFactory : IJobFactory
{
private readonly IServiceProvider _rootServiceProvider;

Keybase proof

I hereby claim:

To claim this, I am signing this object:

This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>OMD</title>
<style>
body { padding: 0; font-family: "Segoe UI", Helvetica, Arial, sans-serif }
header { margin-bottom: 20px; display: flex; align-items: center; }
header > .brand { flex-basis: 50%; }
public class EventSubscription<TPayload> : IEventSubscription<TPayload>
{
private readonly WeakReference<NotificationDelegate<TPayload>> _notificationRef;
private readonly WeakReference<FilterDelegate<TPayload>> _filterRef;
/// <summary>
/// Initialises a new instance of <see cref="EventSubscriberBase{TEvent, TPayload}"/>
/// </summary>
/// <param name="token">The subscription token</param>
/// <param name="notification">The notification delegate</param>
// Copyright (c) Fresh Egg Limited. All rights reserved
namespace Fx.Messaging.Distributed.Host
{
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Fx.DistributedServices;
public class DynamicRouter : IRouter
{
private IRouter _router;
public DynamicRouter(IRouter router)
{
_router = router;
}
public Task RouteAsync(RouteContext context)
@Antaris
Antaris / Common.props
Last active May 17, 2017 10:31
Flexible package management with MSBuild
<Project>
<!-- TARGET FRAMEWORKS -->
<ItemGroup Condition="'$(TargetFramework)'=='netstandard1.6'">
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp1.1'">
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
</ItemGroup>
<!-- /TARGET FRAMEWORKS -->
@Antaris
Antaris / MyContext.cs
Created October 14, 2016 05:27 — forked from divega/MyContext.cs
Simple builder class for creating TVPs that work in .NET Core 1.0
using Microsoft.EntityFrameworkCore;
namespace TvpSampleApp
{
public class MyContext : DbContext
{
public DbSet<Person> People { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
@Antaris
Antaris / BlogDbContext.cs
Last active October 18, 2016 08:32
Early work on custom type conversions for Entity Framework
public class BlogDbContext : DbContext
{
public DbSet<BlogPost> Posts { get; set; }
}