Skip to content

Instantly share code, notes, and snippets.

View bjcull's full-sized avatar
💲
Helping people get paid

Ben Cull bjcull

💲
Helping people get paid
View GitHub Profile
@bjcull
bjcull / nav-wizard.bootstrap.css
Last active March 5, 2017 22:30
Wizard style navigation tabs for bootstrap
.nav-pills.nav-wizard > li {
position: relative;
overflow: visible;
border-right: 15px solid transparent;
border-left: 15px solid transparent;
}
.nav-pills.nav-wizard > li + li {
margin-left: 0;
}
.nav-pills.nav-wizard > li:first-child {
// jquery.jqax.js - A plugin for jQuery ajax wrapping some common
// functionality aimed at .NET services and page methods
// Ben Cull - 18 August 2010
(function($) {
$.jQax = function(options) {
// Load Defaults and make them public
this.defaults = {
ShowLoading: true,
@bjcull
bjcull / AddAllClaimAction.cs
Last active May 18, 2018 14:05
Adds all custom claims to the asp.net core identity
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)
public static class AsExpandableExtension
{
public static IQueryable<T> AsExpandable<T>(this IQueryable<T> source)
{
if (source is ExpandableQuery<T>)
{
return (ExpandableQuery<T>)source;
}
@bjcull
bjcull / loading-button.js
Created July 8, 2015 13:16
An angular directive for the Ladda loading button. (Requires the jquery ladda plugin).
.directive('loadingButton', [
'$compile', function($compile) {
return {
restrict: 'A',
link: function(scope, element, attr) {
/* attr.style == "data-style" */
if (attr.loadingButtonAnimation && !attr.style) {
element.attr("data-style", attr.loadingButtonAnimation);
} else if (!attr.loadingButtonAnimation && !attr.style) {
element.attr("data-style", "slide-left");
@bjcull
bjcull / ChartDraw.html
Created May 23, 2015 22:11
A prototype graph with user drawn lines over the top
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
@bjcull
bjcull / ActiveRouteTagHelper.cs
Last active June 8, 2018 12:14 — forked from anonymous/ActiveRouteTagHelper.cs
Adds an "active" class to the given element when the route parameters match. An Active Route Tag Helper.
[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>
[HtmlAttributeName("asp-action")]
public string Action { get; set; }
@bjcull
bjcull / WordDocumentAttribute.cs
Created January 30, 2014 03:52
A Filter Attribute that lets you download an ASP.NET MVC View as a Word Document
public class WordDocumentAttribute : ActionFilterAttribute
{
public string DefaultFilename { get; set; }
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
var result = filterContext.Result as ViewResult;
if (result != null)
result.MasterName = "~/Views/Shared/_LayoutWord.cshtml";
@bjcull
bjcull / paymentsInProcess.qry
Created March 29, 2019 04:32
SQL Output for my perhaps not so efficient query
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
bjcull / SubdomainRoute.cs
Created February 18, 2015 10:22
A class to detect the subdomain and pass it through as a route parameter
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;