Skip to content

Instantly share code, notes, and snippets.

<#@ template debug="true" hostspecific="false" language="C#" #>
<#@ assembly name="System" #>
<#@ assembly name="System.Configuration" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Data" #>
<#@ assembly name="System.Design" #>
<#@ assembly name="System.DirectoryServices" #>
<#@ assembly name="System.Drawing" #>
<#@ assembly name="System.IO.Compression.FileSystem" #>
<#@ assembly name="System.Runtime.Caching" #>
@IvanLieckens
IvanLieckens / JssFieldsExtender.cs
Created June 4, 2019 07:56
Sitecore JSS GraphQL schema extension to output fields in JSS format
using GraphQL.Types;
using Newtonsoft.Json;
using Sitecore.Configuration;
using Sitecore.Data.Items;
using Sitecore.Data.Fields;
using Sitecore.Diagnostics;
using Sitecore.LayoutService.Serialization.FieldSerializers;
using Sitecore.LayoutService.Serialization.ItemSerializers;
using Sitecore.LayoutService.Serialization.Pipelines.GetFieldSerializer;
using Sitecore.Services.GraphQL.Content.GraphTypes;
@IvanLieckens
IvanLieckens / disconnected-mode-proxy.js
Created June 5, 2019 09:39
JSS Disconnected mode GraphQL (Integrated + Connected) - Proof of Concept
/*
When the app runs in disconnected mode, and Sitecore is not present, we need to give
the app copies of the Sitecore APIs it depends on (layout service, dictionary service, content service)
to talk to so that the app can run using the locally defined disconnected data.
This is accomplished by spinning up a small Express server that mocks the APIs, and then
telling the dev server to proxy requests to the API paths to this express instance.
*/
// these environment variables are necessary for Vue to allow us
@IvanLieckens
IvanLieckens / RenderingParametersExtensions.cs
Created August 28, 2019 13:13
Handy extension methods for RenderingParameters in Sitecore MVC
using Sitecore.Data;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Mvc.Presentation;
using Sitecore.Resources.Media;
namespace Foundation.Extensions
{
public static class RenderingParametersExtensions
@IvanLieckens
IvanLieckens / EXM.config
Created September 25, 2019 06:23
Sitecore EXM rewriting of HTML tables to better support Experience Editor while retaining original output
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentManagement">
<pipelines>
<mvc.renderRendering>
<processor type="Project.EXM.Pipelines.RenderRendering.ExmTableRewriter, Project.EXM"/>
</mvc.renderRendering>
</pipelines>
</sitecore>
</configuration>
@IvanLieckens
IvanLieckens / Sync-Theme.ps1
Last active September 17, 2020 09:22
Powershell to sync SXA themes with TDS serialized items
Param(
[string]$ThemePath = "sitecore\media library\Themes\Project\Shared\Project",
[string]$FilesPath = ".\-\media\Themes\Project\Shared\Project",
[string]$TdsPath = "..\Project\TDS.Master",
[string]$TdsProject = "TDS.Master.scproj",
[string]$TypeLoadPath = ".\Binaries",
[string]$UpdateFile = "",
[string]$DeleteFile = "",
[string]$ItemId = ""
)
@IvanLieckens
IvanLieckens / FilteredUnzip.cs
Created April 16, 2020 08:13
Filtered Unzip Task for MSBuild based on standard Unzip task (https://github.com/microsoft/msbuild/issues/5169)
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Resources;
using System.Text.RegularExpressions;
using System.Threading;
using Microsoft.Build.Framework;
@IvanLieckens
IvanLieckens / InstallSolr.ps1
Created August 12, 2020 10:03
PowerShell Installing OJDK+SOLR (Kudos to Mark Cassidy for initial version)
Param(
$installFolder = "c:\",
$solrPort = "8983",
$solrHost = "solr881",
$solrSSL = $true,
$downloadFolder = "$env:Temp"
)
$solrVersion = "8.1.1"
$solrName = "solr-$solrVersion"
@IvanLieckens
IvanLieckens / ImportLanguage.aspx
Created October 22, 2020 08:57
SIF: Installing Language Pack
<%@ page language="C#" autoeventwireup="true" inherits="Sitecore.sitecore.admin.AdminPage" %>
<%@ import namespace="Sitecore.Abstractions" %>
<%@ import namespace="Sitecore.Jobs" %>
<%@ import namespace="Sitecore.Shell.Applications.Globalization.ImportLanguage" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
CheckSecurity(true);
@IvanLieckens
IvanLieckens / Prerequisites-Offline.ps1
Created November 4, 2020 08:32
SIF Offline Prerequisites 9.3
Import-Module -Name SitecoreInstallFramework -Force -RequiredVersion 2.2.0
# Installer files and packages
$VisualCPP2015x64 = Resolve-Path "..\..\Packages\vc_redist.x64.exe"
$SqlServerPSModulePackageFolder = Resolve-Path "..\..\Packages\"
$SharedManagementObjectsInstallerx86 = Resolve-Path "..\..\Packages\SharedManagementObjects_x86.msi"
$SharedManagementObjectsInstallerx64 = Resolve-Path "..\..\Packages\SharedManagementObjects_x64.msi"
$WebDeployInstaller = Resolve-Path "..\..\Packages\WebDeploy_amd64_en-US.msi"
$URLRewriteInstaller = Resolve-Path "..\..\Packages\rewrite_amd64_en-US.msi"
$SQLClrTypesx86 = Resolve-Path "..\..\Packages\SQLSysClrTypes_x86.msi"