Skip to content

Instantly share code, notes, and snippets.


John Rappel jraps20

View GitHub Profile
jraps20 / PublishUtils.cs
Last active May 2, 2022 17:40
Sitecore publishing Utils to quickly queue up a batch of items to a publish queue and publish the queue, as opposed to individual publishes which cause the publish:end event to fire multiple times (read: individual index updates, cache clearing, etc.)
View PublishUtils.cs
public static class PublishUtils
public static void CreateAndPublishQueue(Database sourceDatabase, Database[] targetDatabases, Language[] targetLanguages, IEnumerable<ID> itemIds, bool skipEvents = false, bool useSecurityDisabler = true)
Assert.IsNotNull(sourceDatabase, "sourceDatabase");
Assert.IsNotNull(targetDatabases, "targetDatabases");
Assert.IsNotNull(targetLanguages, "targetLanguages");
var publishingCandidates = SetPublishingCandidates(sourceDatabase, targetDatabases, targetLanguages, itemIds);
jraps20 / RemoveBinFilesFromUpdatePackage.ps1
Last active September 19, 2017 12:59
Remove \bin Files from a Sitecore Update package. This came about due to the fact that the TDS package generator adds `HedgehogDevelopment.SitecoreProject.PackageInstallPostProcessor.dll` even when you select not to include files with the package. By removing this file, the app pool does not recycle during installations. This requires that `Hedg…
View RemoveBinFilesFromUpdatePackage.ps1
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
param([string]$zipfile, [string]$outpath)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
jraps20 / PublishDeployedItemsWithPublishingQueue.cs
Last active July 19, 2018 11:09
TDS Post Deploy Action to publish items via publishing queue instead of native solution
View PublishDeployedItemsWithPublishingQueue.cs
[Description("Publishes deployed items after deployment using publishing queue.\nPublishing targets are specified in the Parameter as a comma separated list.")]
public class PublishDeployedItemsWithPublishingQueue : IPostDeployAction
/// <summary>
/// Borrowed directly from HedgehogDevelopment.SitecoreProject.PackageInstallPostProcessor.BuiltIn.PublishDeployedItems, HedgehogDevelopment.SitecoreProject.PackageInstallPostProcessor
/// </summary>
private static Database[] GetPublishingTargetDatabases(string parameters)
if (string.IsNullOrEmpty(parameters))
jraps20 / SitecorePdf.xml
Last active October 24, 2017 03:44
Config file for use in Sitecore PDF Generation
View SitecorePdf.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="">
<!-- Disable security check -->
<processor type="Sitecore.ContentTesting.Pipelines.GetScreenShotForURL.CheckDisabler, Sitecore.ContentTesting">
<patch:delete />
jraps20 / AddTimeoutToScript.cs
Created October 24, 2017 03:46
Gist to illustrate modifying the PhantomJS default timeout of zero to a new value
View AddTimeoutToScript.cs
using Sitecore.ContentTesting.Pipelines.GetScreenShotForURL;
namespace MyLibrary.GetScreenShotForURL
public class AddTimeoutToScript : GenerateScreenShotProcessor
public string Timeout { get; set; }
private const string StandardExit = "phantom.exit();\r\n});";
jraps20 / GeneratePdf.cs
Created October 24, 2017 03:49
Gist to illustrate saving a PNG generated via Sitecore PhantomJS as a PDF.
View GeneratePdf.cs
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using Sitecore.ContentTesting.Pipelines.GetScreenShotForURL;
namespace MyLibrary.GetScreenShotForURL
public class GeneratePdf : GenerateScreenShotProcessor
public override void Process(GetScreenShotForURLArgs args)
View SimpleSitecorePdf.cs
var args = new GetScreenShotForURLArgs(item.ID);
CorePipeline.Run("getScreenShotForURL", args);
View LogMessageRemoteEvent.cs
public class LogMessageRemoteEvent : IHasEventName
public LogMessageRemoteEvent(string instanceName, string eventName)
InstanceName = instanceName;
EventName = eventName;
// This is the custom data you will be passing between servers
View LogMessageRemoteMap.cs
public class LogMessageRemoteMap
public void Initialize(PipelineArgs args)
EventManager.Subscribe<LogMessageRemoteEvent>(new Action<LogMessageRemoteEvent>(OnGenericRemoteEvent<LogMessageRemoteEvent>));
private static void OnGenericRemoteEvent<TEvent>(TEvent @event) where TEvent : IHasEventName
RemoteEventArgs<TEvent> remoteEventArgs = new RemoteEventArgs<TEvent>(@event);
View LogMessageRemote.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="">
<processor type="MyNamespace.LogMessageRemoteMap, MyDll" method="Initialize" />