Skip to content

Instantly share code, notes, and snippets.

View herskinduk's full-sized avatar

Kern Herskind Nightingale herskinduk

View GitHub Profile
@herskinduk
herskinduk / ChildActionRenderer.cs
Last active December 20, 2015 07:19
Experimental Sitecore ChildActionRenderer - like ControllerRenderer, but using the HtmlHelper Action extension method for rendering. Standard MVC child action behaviour wrt TempData. Has dependencies on the Sitecore.MVC.Contrib project.
using Sitecore.Mvc.Common;
using Sitecore.Mvc.Presentation;
using Sitecore.Mvc.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Web.Mvc.ExpressionUtil;
@herskinduk
herskinduk / AreaControlllerRunner.cs
Created July 29, 2013 06:30
Experimental Sitecore ControllerRunner with childaction behaviour. Based on the AreaControllerRunner from the Sitecore.MVC.Contrib project.
using Sitecore.Mvc.Controllers;
using System.Web.Mvc;
using System.Web.Routing;
using Sitecore.Mvc.Presentation;
using Sitecore.Mvc.Common;
namespace Sitecore.Mvc.Contrib.Controllers
{
public class AreaControllerRunner : ControllerRunner, IControllerRunner
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sitecore.ContentSearch.ComputedFields;
using Sitecore.ContentSearch;
using Spatial4n.Core.Context;
using Lucene.Net.Spatial.Prefix.Tree;
using Lucene.Net.Spatial.Prefix;
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=...&sensor=false">
</script>
public class LazySearchService : ISearchService
{
public readonly ISearchService innerService;
public LazySearchService(ISearchService innerService)
{
this.innerService = innerService;
}
public ISearchResult Search(SearchCriteria criteria)
////////////////////////////////////
// //
// AUTO GENERATED. DO NOT EDIT. //
// //
////////////////////////////////////
using System.Collections;
using System.Collections.Generic;
using System.Linq;
<#@ template hostspecific="true" language="C#" #>
<#@ output extension=".txt" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="VSLangProj" #>
<#@ import namespace="System" #>
<#@ import namespace="System.Reflection" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ assembly name="EnvDTE" #>
@herskinduk
herskinduk / gist:7a67839b4af39fc7ebcc
Created October 15, 2014 10:44
Assembly bindings to be added to Sitecore web.config for MVC5
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<!--<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
@herskinduk
herskinduk / SkinnedSublayout.cs
Last active August 29, 2015 14:07
Resolve Active Commerce and SBOS accelerators Sublayout conflict
using ActiveCommerce.Extensions;
namespace SbosAcceleratorsPlusActiveCommerce
{
public class SkinnedSublayout : global::Sitecore.SbosAccelerators.Shared.Web.UI.WebControls.Sublayout
{
protected override void CreateChildControls()
{
if (global::Sitecore.Context.Site != null)
{
@herskinduk
herskinduk / Mvc1.cshtml
Last active April 25, 2016 22:12
Sitecore MVC Layout views
@using Sitecore.Mvc
@using Sitecore.Mvc.Analytics.Extensions
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>@Html.Sitecore().Field("title", new { DisableWebEdit = true })</title>
@Html.Sitecore().VisitorIdentification()