Skip to content

Instantly share code, notes, and snippets.

View jonupchurch's full-sized avatar

Jon Upchurch jonupchurch

View GitHub Profile
.*?"Name":\s"(?<CaptureValue>.+?)".*?}
@jonupchurch
jonupchurch / IgnitionExtensions.cs
Created June 1, 2016 02:08
A quick and easy way to get all Base templates of an Item in Sitecore
public static IEnumerable<TemplateItem> GetAllMasters(this Item item)
{
var nodes = new Stack<TemplateItem>(new[] { item.Template });
var node = nodes.Pop();
yield return node;
foreach (var n in node.BaseTemplates) nodes.Push(n);
}
filterSelectElements: function() {
jQuery("select,input:checkbox").not(".form-gate").change(function () {
var selectedItems = jQuery("select,input:checkbox:checked,input#filterq").not(".form-gate");
var url = "?page=1&overridedefault=true";
// Grab all select boxes and check if they need to redirect to a url
var selectUrl = false;
var selectElements= jQuery("select");
jQuery(selectElements).each(function (count, item) {
@jonupchurch
jonupchurch / gist:8639344
Created January 26, 2014 20:54
Base class and derived class that has indexed and non-indexed fields
[SitecoreType]
public class GlassFrameBase
{
#region Base Members
[SitecoreId, IndexField("_id")]
public virtual Guid Id { get; set; }
[SitecoreInfo(SitecoreInfoType.Language), IndexField("_language")]
public virtual string Language { get; set; }
public IEnumerable<T> Search<T>(Func<T, bool> whereCriteria) where T : GlassFrameBase, new()
{
using (var context = _index.CreateSearchContext())
{
try
{
var type = typeof(T);
if (!_service.GlassContext.TypeConfigurations.ContainsKey(type))
{
_service.GlassContext.Load(new AttributeTypeLoader(type));
@jonupchurch
jonupchurch / gist:5969085
Created July 10, 2013 19:00
For reference in the Google Group
//our base implementation
[SitecoreType]
public class GlassBase : IGlassBase
{
[SitecoreId]
public virtual Guid Id { get; private set; }
[SitecoreInfo(SitecoreInfoType.Language)]
public virtual Language Language { get; private set; }
@jonupchurch
jonupchurch / gist:5757545
Last active December 18, 2015 08:59
GSA Wrapper
/****************************************
* GSALib Wrapper for Google Search Appliance
* GSA.Paragon.Utils
* Written by Jon Upchurch
* Copyright 2013 by Paragon Consulting, Inc.
* Free to use, distribute, and modify
* with this credit comment retained.
****************************************/
using GSALib.Constants;
using GSALib.GSA;
[SitecoreClass(TemplateId = "My-Guid-Here")]
public class DictionaryDomain : GlassBase {}
[SitecoreClass(TemplateId = "My-Guid-Here")]
public class DictionaryEntry : GlassBase
{
[SitecoreField]
public virtual string Key { get; set; }
[SitecoreField]
public virtual string Phrase { get; set; }