Skip to content

Instantly share code, notes, and snippets.

Dan Booth DanDiplo

View GitHub Profile
View FourOhFourFinder.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Web.Routing;
namespace Diplo.Core
{
/// <summary>
@DanDiplo
DanDiplo / umbraco_extensions.cs
Last active Dec 28, 2016
A few useful extension methods for Umbraco IPublishedContent.
View umbraco_extensions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web;
/// <summary>
/// A few useful extension methods for Umbraco IpublishedContent
@DanDiplo
DanDiplo / QueryStringHelper.cs
Last active Feb 7, 2019
QueryString Helper
View QueryStringHelper.cs
// Code examples of using my QueryStringHelper c# class for parsing query string values
// See https://github.com/DanDiplo/QueryString-Helper
QueryStringHelper qs1 = new QueryStringHelper(Request.QueryString); // initialise from Request.QueryString
string query = "?page=5&username=dan&year=2010&enabled=true&email=dan@example.com&option=apple&option=banana&option=melon&date=2015/07/06";
QueryStringHelper qs = new QueryStringHelper(query); // intialise from string
@DanDiplo
DanDiplo / JS-LINQ.js
Last active Aug 4, 2020
JavaScript equivalents of some common C# LINQ methods. To help me remember!
View JS-LINQ.js
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
@DanDiplo
DanDiplo / AngularRepeatLast
Created Sep 24, 2014
AngularJS Directive to trigger on last item in ng-repeat
View AngularRepeatLast
// app directive
.directive('onLastRepeat', function () {
return function (scope, element, attrs) {
if (scope.$last) setTimeout(function () {
scope.$emit('onRepeatLast', element, attrs);
}, 1);
};
})
@DanDiplo
DanDiplo / 0_reuse_code.js
Created Feb 13, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.