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 '\*', '.*') + ').*$).*'
// 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;
@Antaris
Antaris / BarConfigurationElement.cs
Created January 23, 2012 16:51
Heterogeneous Configuration Collections
public class BarConfigurationElement : NamedConfigurationElementBase
{
private const string BarValueAttribute = "barValue";
[ConfigurationProperty(BarValueAttribute, IsRequired = true)]
public string BarValue
{
get { return (string)this[BarValueAttribute]; }
}
}
@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;
@Antaris
Antaris / Disposable.js
Last active February 6, 2021 19:47
A C#-like dispose pattern implemented in javascript - with underscorejs and qunit. Testable: http://jsfiddle.net/52CnZ/14/
!function(root, _, undefined) {
var Disposable = root.Disposable = function() {
this.disposed = false;
};
Disposable.prototype = {
_dispose: function() {
if (!this.disposed) {
this.dispose();
this.disposed = true;
@Antaris
Antaris / HomeController.cs
Created October 22, 2011 09:50
An updated model binder that supports async and non-async file uploads.
namespace AsyncUpload.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
@Antaris
Antaris / DotNetCoreVersionExtensions.cs
Created August 12, 2016 07:53
An approach to building .NET Core applications with Cake, XUnit and synchronous `project.json` versionining for both local and on Bamboo
namespace Cake.DotNetVersion
{
using System;
using System.Collections.Generic;
using Cake.Core;
using Cake.Core.Annotations;
using Cake.Core.IO;
/// <summary>
/// Contains functionality required to updating project file versions.

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>