Skip to content

Instantly share code, notes, and snippets.


Mark Cassidy cassidydotdk

  • Cassidy Consult
  • St. Gallen, Switzerland
View GitHub Profile
cassidydotdk / EntryPoint.ps1
Created Aug 3, 2021
A replacement for Sitecore's Development.ps1 Docker entrypoint script that does not blow up if you do not volume mount C:\deploy
View EntryPoint.ps1
[Parameter(Mandatory = $false)]
# Setup
$ErrorActionPreference = "Stop"
$InformationPreference = "Continue"
$timeFormat = "HH:mm:ss:fff"
cassidydotdk / DockerFile
Created Aug 1, 2021
Setting up a Docker based VSTS Agent that can run Docker commands
View DockerFile
# escape=`
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Set-ExecutionPolicy RemoteSigned -Force; Set-ExecutionPolicy Unrestricted -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))
RUN choco install docker -y
cassidydotdk / Build.ps1
Last active May 23, 2021
Complete Build and Publish Script. Will deploy all projects to publishing target, no HPP required.
View Build.ps1
View How to get Docker for Windows running inside a Hyper-V Virtual Machine
- Create your VM as normal, get Windows installed and so on
- Power the VM down, to "Off" state
- On the HOST pc, execute the following 2 commands from an elevated Powershell prompt
Set-VMProcessor -VMName "Name of your VM" -ExposeVirtualizationExtensions $true
Get-VMNetworkAdapter -VMName "Name of your VM" | Set-VMNetworkAdapter -MacAddressSpoofing On
- Start up the VM again
- Inside the VM, execute the following command from an elevated Powershell prompt
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"
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.
View Install-Solr.ps1
$installFolder = "c:\solr",
$solrPort = "8721",
$solrHost = "solr",
$solrSSL = $true,
$downloadFolder = "$PSScriptRoot"
$solrVersion = "7.2.1"
$solrName = "solr-$solrVersion"
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')])
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}));
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)