Skip to content

Instantly share code, notes, and snippets.

Avatar

John Rappel jraps20

View GitHub Profile
@jraps20
jraps20 / RemoveBinFilesFromUpdatePackage.ps1
Last active Sep 19, 2017
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
Param(
[string]$pathToPackages
)
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
param([string]$zipfile, [string]$outpath)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
@jraps20
jraps20 / SitecorePdf.xml
Last active Oct 24, 2017
Config file for use in Sitecore PDF Generation
View SitecorePdf.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<getScreenShotForURL>
<!-- Disable security check -->
<processor type="Sitecore.ContentTesting.Pipelines.GetScreenShotForURL.CheckDisabler, Sitecore.ContentTesting">
<patch:delete />
</processor>
@jraps20
jraps20 / AddTimeoutToScript.cs
Created Oct 24, 2017
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
jraps20 / GeneratePdf.cs
Created Oct 24, 2017
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 LogMessageLocal.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<events>
<event name="logMessage:remote">
<handler type="MyNamespace.LogMessageRemote, MyDll" method="LogInstanceName" />
</event>
</events>
</sitecore>
</configuration>
View LogMessageRemote.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="MyNamespace.LogMessageRemoteMap, MyDll" method="Initialize" />
</initialize>
</pipelines>
</sitecore>
</configuration>
View QueueRemoteEvent.cs
var remoteEvent = new LogMessageRemoteEvent(Sitecore.Configuration.Settings.InstanceName, "logMessage:remote");
Sitecore.Eventing.EventManager.QueueEvent<LogMessageRemoteEvent>(remoteEvent);
@jraps20
jraps20 / GetDatasourceDependencies.cs
Last active Jan 12, 2018
Full set of classes and config changes required to index modular content in Sitecore, i.e. content that is added to the page as a separate rendering with a datasource. Configured to only index certain renderings based on config, to disallow indexing of renderings that may be "Related Items" or other types of renderings that are shared and not pe…
View GetDatasourceDependencies.cs
using System.Linq;
using Sitecore;
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.Pipelines.GetDependencies;
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
namespace Common.Sitecore.Search.GetDependencies
{
View IndexableRenderings.xml
<indexableRenderings>
<rendering name="RichText" id="{4F8942FF-C4E4-408A-B3D5-4657EE5050CA}" />
</indexableRenderings>