Skip to content

Instantly share code, notes, and snippets.

Mark Cassidy cassidydotdk

  • Cassidy Consult
  • St. Gallen, Switzerland
View GitHub Profile
cassidydotdk / Setup Unicorn in Docker.txt
Last active Sep 27, 2019
How to configure Unicorn with a volume mapping for your CM server Docker container
View Setup Unicorn in Docker.txt
How to set up Unicorn in your Docker container
Since all writing to Unicorn files happens inside the container, and the container is now linked to .\unicorn,
all you need to do is ensure that .\unicorn is included under source control.
This gets even better if you use Transparent Sync.
cassidydotdk / Gulpfile.js
Last active Jul 1, 2019
Managing Unicorn targetDataStore in Gulp pipeline
View Gulpfile.js
var rename = require('gulp-rename');
var replace = require('gulp-replace');
function(callback) {
console.log("Executing Unicorn Sync");
gulp.src([path.resolve(config.websiteRoot + '/App_Config/Include/zzz/Unicorn.TargetDataStore.config.EDITME')])
cassidydotdk / gulp-config.js
Last active Mar 30, 2020
Task to build and publish a .SLN file from gulp using "msbuild" instead of "gulp-msbuild". Version 16.0 for VS2019, use 15.0 for VS2017.
View gulp-config.js
module.exports = function () {
var config = {
websiteRoot: "C:\\inetpub\\wwwroot\\",
sitecoreLibraries: "C:\\inetpub\\wwwroot\\\\bin",
hostName: "",
solutionName: "sc911",
buildConfiguration: "Debug",
runCleanBuilds: false,
toolsVersion: "16.0"
View Install-Solr.ps1
$installFolder = "c:\solr",
$solrPort = "8721",
$solrHost = "solr",
$solrSSL = $true,
$downloadFolder = "$PSScriptRoot"
$solrVersion = "7.2.1"
$solrName = "solr-$solrVersion"
View BaseController.cs
public virtual Tuple<string, string> GetAdaptiveImageUrls(Item item, string imageFieldName, int maxWidth = 300)
Assert.IsNotNull(item, nameof(item));
Assert.IsNotNullOrEmpty(imageFieldName, nameof(imageFieldName));
ImageField imageField = item.Fields[imageFieldName];
if (imageField?.MediaItem != null /*&& imageField.MediaItem.Versions.Count > 0*/)
string imageUrl = HashingUtils.ProtectAssetUrl(MediaManager.GetMediaUrl(imageField.MediaItem, new MediaUrlOptions {MaxWidth = maxWidth}));
cassidydotdk / gist:519dee612ca4683a18303298a429715c
Created Aug 15, 2016
Controller Factory Handling - Sitecore 8.1 and Castle Windsor
View gist:519dee612ca4683a18303298a429715c
using System.Web.Mvc;
using Castle.Windsor;
using Sitecore.Mvc.Controllers;
using Sitecore.Mvc.Pipelines.Loader;
using Sitecore.Pipelines;
using Interfaces.Managers.Windsor;
using ControllerBuilder = System.Web.Mvc.ControllerBuilder;
namespace Website
cassidydotdk / RenderItem.cs
Created Aug 11, 2016
Quickly render a Sitecore Controller Rendering, using given Item as Datasource
View RenderItem.cs
public virtual HtmlString RenderItem(Item item, string controller, string action)
Assert.ArgumentNotNull(item, "item");
Assert.ArgumentNotNullOrEmpty(controller, "controller");
Assert.ArgumentNotNullOrEmpty(action, "action");
var r = new Rendering();
r.DataSource = item.Paths.FullPath;
using (RenderingContext.EnterContext(r))
View PerformanceMeasurementProcessorBegin.cs
using System.Diagnostics;
using System.Web;
using Sitecore.Mvc.Pipelines.Response.RenderRendering;
namespace Website.Pipelines.RenderRendering
public class PerformanceMeasurementProcessorBegin : RenderRenderingProcessor
public override void Process(RenderRenderingArgs args)
cassidydotdk / SetupIoc.config
Created May 18, 2016
Setup Castle Windsor for Sitecore 8.1
View SetupIoc.config
<?xml version="1.0"?>
<processor type="Website.SetupIoc, Website" />
You can’t perform that action at this time.