Skip to content

Instantly share code, notes, and snippets.

@GuitarRich
GuitarRich / GenerateTemplatesStruct.ps1
Created Nov 15, 2018
Generates a Templates.cs struct for a given Sitecore Template
View GenerateTemplatesStruct.ps1
function Get-CleanName()
{
param (
[string] $Name
)
return $Name.Replace(" ", "")
}
$templateItem = Get-Item .
View SearchExtensions.cs
public static class SearchExtensions
{
public static IQueryable<TSource> ContainsOr<TSource, TKey>(this IQueryable<TSource> queryable, Expression<Func<TSource, TKey>> keySelector, IEnumerable values) where TKey : IEnumerable
{
return Contains(queryable, keySelector, values, true);
}
public static IQueryable<TSource> ContainsAnd<TSource, TKey>(this IQueryable<TSource> queryable, Expression<Func<TSource, TKey>> keySelector, IEnumerable values) where TKey : IEnumerable
{
return Contains(queryable, keySelector, values, false);
@GuitarRich
GuitarRich / JsxResult.cs
Created Jul 22, 2016
Sitecore and React Examples
View JsxResult.cs
namespace Sitecore.Foundation.React.Mvc
{
using System;
using System.Globalization;
using System.IO;
using System.Text;
using System.Web.Mvc;
public class JsxResult : ViewResult
{
View AssembleyReferences.tt
<#@ Assembly Name="$(SolutionDir)\packages\Fortis.3.5.5.2\lib\net45\Fortis.dll" #>
<#@ Assembly Name="$(SolutionDir)\..\Libraries\Sitecore.Kernel.dll" #>
<#@ assembly name="$(ProjectDir)$(OutDir)Transitus.Rainbow.dll" #>
@GuitarRich
GuitarRich / Benchmark.cs
Last active Aug 29, 2015
Fortis Object Mapper Performance
View Benchmark.cs
var items = Sitecore.Context.Database.GetItem(new ID("{1FBCAB2D-8444-43FB-916C-951AE3FA244E}")).Axes.GetDescendants();
Response.Write("<h1>{0} Items</h1>".FormatWith(items.Length));
var sw = new Stopwatch();
sw.Start();
var displayNamesScapi = items.Select(item => item[FieldIDs.DisplayName]).ToList();
sw.Stop();
You can’t perform that action at this time.