Skip to content

Instantly share code, notes, and snippets.

View epperson's full-sized avatar

Kenny Epperson epperson

  • Ntara
  • Johnson City, TN
View GitHub Profile
@epperson
epperson / orders.js
Created September 9, 2020 20:38
JS Grouping
var orders = [
{ orderId: 'I8001', customerId: '5142' },
{ orderId: 'I1006', customerId: '5142' },
{ orderId: 'I1009', customerId: '5142' },
{ orderId: 'I1001', customerId: '5145' },
{ orderId: 'I9999', customerId: '5146' }
],
result = orders.reduce(function (r, a) {
r[a.customerId] = r[a.customerId] || [];
@epperson
epperson / DocumentSearchEventArgsExtensions.cs
Created September 9, 2019 15:39
Extension method for adding content to an instance of a DocumentSearchEventArgs (Kentico)
using CMS.DocumentEngine;
namespace Example.Linq
{
public static class DocumentSearchEventArgsExtensions
{
public static void AddContent(this DocumentSearchEventArgs searchEventArgs, string content)
{
searchEventArgs.Content += $" {content}";
}
@epperson
epperson / SearchModule.cs
Created September 9, 2019 15:38
Retrieve string content from JSON properties with supplied names (Kentico)
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using CMS;
using CMS.DataEngine;
using CMS.DocumentEngine;
using Example.Linq;
using Example.Search;