Skip to content

Instantly share code, notes, and snippets.

Ben Cull bjcull

Block or report user

Report or block bjcull

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bjcull / paymentsInProcess.qry
Created Mar 29, 2019
SQL Output for my perhaps not so efficient query
View paymentsInProcess.qry
DECLARE @__submerchantId_0 int = 147;
DECLARE @__startDateLocal_Value_1 datetime2(7) = '2019-01-25';
DECLARE @__endDateLocal_Value_2 datetime2(7) = '2019-03-29';
DECLARE @__p_3 int = 0;
DECLARE @__p_4 int = 50;
SELECT [x.Payer].[Id], [x.Payer].[AssemblyBuyerId], [x.Payer].[CreatedTimeUtc], [x.Payer].[DisplayId], [x.Payer].[EmailAddress], [x.Payer].[FirstName], [x.Payer].[ImportSource], [x.Payer].[ImportSourceReference], [x.Payer].[IsDeleted], [x.Payer].[LastName], [x.Payer].[MobileNumber], [x.Payer].[Postcode], [x.Payer].[StreetAddress], [x.Payer].[SubMerchantId], [x.Payer].[Suburb], [x].[DisplayId] AS [Id0],
SELECT TOP(1) [y3].[Status]
FROM [Attempts] AS [y3]
bjcull / AddAllClaimAction.cs
Last active May 18, 2018
Adds all custom claims to the core identity
View AddAllClaimAction.cs
public class AddAllClaimAction : ClaimAction
public AddAllClaimAction() : base(null, null)
public override void Run(JObject userData, ClaimsIdentity identity, string issuer)
var claims = userData.Properties()
.Where(x => !x.Value.HasValues)
View AsExpandableExtension.cs
public static class AsExpandableExtension
public static IQueryable<T> AsExpandable<T>(this IQueryable<T> source)
if (source is ExpandableQuery<T>)
return (ExpandableQuery<T>)source;
bjcull / TimeService.cs
Created Nov 27, 2017
The current time service I use to keep track of dates relative to a certain timezone.
View TimeService.cs
public class TimeService : ITimeService
private readonly ILogger _logger;
private Instant? _frozenTime;
private Instant _realTimeAtTimeOfFreezing = Instant.MinValue;
private readonly IDateTimeZoneProvider _timeZoneProvider = DateTimeZoneProviders.Tzdb;
private readonly DateTimeZone _timeZone;
public TimeService(ILogger logger, string systemTimeZone, DateTime? setDate = null)
bjcull / Install-Seq.ps1
Last active Oct 26, 2017 — forked from dennisroche/Install-Seq.ps1
Download and install Seq ( Can be used by Azure Resource Manager template. Use RawGit to access the file with proper Content-Type headers -
View Install-Seq.ps1
param (
$installBasePath = "C:\Install\"
$global:seqDataPath = "C:\ProgramData\Seq"
function Write-Log
bjcull / ActiveRouteTagHelper.cs
Last active Jun 8, 2018 — forked from anonymous/ActiveRouteTagHelper.cs
Adds an "active" class to the given element when the route parameters match. An Active Route Tag Helper.
View ActiveRouteTagHelper.cs
[HtmlTargetElement(Attributes = "is-active-route")]
public class ActiveRouteTagHelper : TagHelper
private IDictionary<string, string> _routeValues;
/// <summary>The name of the action method.</summary>
/// <remarks>Must be <c>null</c> if <see cref="P:Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Route" /> is non-<c>null</c>.</remarks>
public string Action { get; set; }
bjcull / loading-button.js
Created Jul 8, 2015
An angular directive for the Ladda loading button. (Requires the jquery ladda plugin).
View loading-button.js
.directive('loadingButton', [
'$compile', function($compile) {
return {
restrict: 'A',
link: function(scope, element, attr) {
/* == "data-style" */
if (attr.loadingButtonAnimation && ! {
element.attr("data-style", attr.loadingButtonAnimation);
} else if (!attr.loadingButtonAnimation && ! {
element.attr("data-style", "slide-left");
bjcull / ChartDraw.html
Created May 23, 2015
A prototype graph with user drawn lines over the top
View ChartDraw.html
<!DOCTYPE html>
<meta charset="utf-8" />
<script src=""></script>
<script src=""></script>
bjcull / CustomRequireHttpsFilter.cs
Created May 15, 2015
An improved HTTPS redirection filter for ASP.NET MVC.
View CustomRequireHttpsFilter.cs
public class CustomRequireHttpsFilter : RequireHttpsAttribute
protected override void HandleNonHttpsRequest(AuthorizationContext filterContext)
// The base only redirects GET, but we added HEAD as well. This avoids exceptions for bots crawling using HEAD.
// The other requests will throw an exception to ensure the correct verbs are used.
// We fall back to the base method as the mvc exceptions are marked as internal.
if (!String.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase)
&& !String.Equals(filterContext.HttpContext.Request.HttpMethod, "HEAD", StringComparison.OrdinalIgnoreCase))
bjcull / SubdomainRoute.cs
Created Feb 18, 2015
A class to detect the subdomain and pass it through as a route parameter
View SubdomainRoute.cs
public class SubdomainRoute : RouteBase
public override RouteData GetRouteData(HttpContextBase httpContext)
if (httpContext.Request == null || httpContext.Request.Url == null)
return null;
var host = httpContext.Request.Url.Host;
You can’t perform that action at this time.