Skip to content

Instantly share code, notes, and snippets.

View drpeck's full-sized avatar
👊
Bossing it

David Peck drpeck

👊
Bossing it
View GitHub Profile
@drpeck
drpeck / header.js
Last active July 23, 2023 07:07
Select active class on top nav
( function() {
function highlightActiveNav() {
// Get the current page's path
const currentPath = window.location.pathname;
// Select all `a` tags within `.nav-item` elements
const navLinks = document.querySelectorAll('.nav-item a');
// Loop through each link to check for a match
navLinks.forEach(link => {
@drpeck
drpeck / CourierUmbracoEvents.cs
Created August 31, 2017 08:04
Hack/ workaround to Umbraco Courier not being updated on slave servers
public class CourierUmbracoEvents : ApplicationEventHandler
{
//Wait 5 seconds after an examine index before trying to republish what has been indexed
private const int DelayAfterIndex = 5 * 1000;
//Give a republishe 2 minutes to complete
private const int IndexTimeout = 120 * 1000;
private Guid _lastIndexId;
private List<int> _indexedContentIds = new List<int>();
private Dictionary<int, DateTime> _republishRegister = new Dictionary<int, DateTime>();