Skip to content

Instantly share code, notes, and snippets.

View vtml's full-sized avatar

Vincent Lui vtml

View GitHub Profile
@vtml
vtml / Project.ACME.Website.ViewsPrecompilation.config
Created December 5, 2019 11:16
LocalDeveloper Environment Based Configuration for Views Precompilation
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:localenv="http://www.sitecore.net/xmlconfig/localenv/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
<settings localenv:require="LocalDeveloper">
<!-- MVC: Flag for controlling whether Razor View Engine will look at physical view last modified dates
when determining to use a view file from a pre-compiled assembly or from the file system.
Default: "false"
-->
<setting name="Mvc.UsePhysicalViewsIfNewer" value="true" />
</settings>
@vtml
vtml / FrontEndBuild.ps1
Last active December 8, 2019 23:14
Sample Front End Build which triggers Creative Exchange Import
<#
.SYNOPSIS
This script runs the Front End Build, with an option to trigger Creative Exchange Import to the Web Site
.DESCRIPTION
This script runs the Front End Build, with an option to trigger Creative Exchange Import process to the specified SXA web site. This can be used on both developer PC's, mainly a back end developer as a back end developer do not neccessarily require the most up to date front end build assets at all times.
.PARAMETER SitecoreWebSiteCreativeExchangeFolderPath
@vtml
vtml / enhanced-ce-import.ps1
Last active March 10, 2021 11:18
Sitecore Creative Exchange Import SPE script
<#
.SYNOPSIS
Performs a Sitecore Creative Exchange Import from the files on disk
.DESCRIPTION
This script utilises the Sitecore Creative Exchange to import front end static assets into the media library. This gives the front end development team full flexibility to use the tools
they are needed to produce the final output. This is a Sitecore Powershell Extension script that should be stored where all the other Script Libraries are placed in Sitecore.
@vtml
vtml / Project.SPE.config
Last active December 3, 2019 03:08
Patch to enable Sitecore Powershell Extensions Restful V2
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:env="http://www.sitecore.net/xmlconfig/env/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<powershell>
<services>
<restfulv2 role:require="ContentManagement or Standalone">
<patch:attribute name="enabled">true</patch:attribute>
<authorization>
<add Permission="Allow" IdentityType="User" Identity="sitecore\CI.User" />
</authorization>
@vtml
vtml / RestfulV2-QueryStringAuth.ps1
Last active December 5, 2019 06:41
Running RestfulV2 Powershell Scripts using Query String Authentication for Sitecore Powershell Extensions 5.0
<#
.SYNOPSIS
This script triggers any SPE scripts that are available to be used through the Restful V2 service. Sitecore Powershell Extensions 5.0 is required. Please use RestfulV2-BasicAuth.ps1 instead if Sitecore Powershell Extensions 5.1 or above is installed in the Sitecore Instance.
.DESCRIPTION
This script triggers any SPE scripts that are available to be used through the Restful V2 service. Sitecore Powershell Extensions 5.0 is required. Please use RestfulV2-BasicAuth.ps1 instead if Sitecore Powershell Extensions 5.1 or above is installed in the Sitecore Instance. This can be used on developer PC's, as well as during CI / CD process. RestfulV2 must be enabled in Sitecore Powershell Extensions for this to work. https://doc.sitecorepowershell.com/security
For Sitecore 9.1 and above that uses the Identity Server, Cognified.PowerShell.IdentityServer.config must be enabled. This config patch is available from SPE 5.1 and above.
@vtml
vtml / RestfulV2-BasicAuth.ps1
Last active December 2, 2019 04:30
Running RestfulV2 Powershell Scripts using Basic Authentication for Sitecore Powershell Extensions 5.1 and above
<#
.SYNOPSIS
This script triggers any SPE scripts that are available to be used through the Restful V2 service. Sitecore Powershell Extensions 5.1 or above is required.
.DESCRIPTION
This script triggers any SPE scripts that are available to be used through the Restful V2 service. Sitecore Powershell Extensions 5.1 or above is required. This can be used on developer PC's, as well as during CI / CD process. RestfulV2 must be enabled in Sitecore Powershell Extensions for this to work. https://doc.sitecorepowershell.com/security
For Sitecore 9.1 and above that uses the Identity Server, Cognified.PowerShell.IdentityServer.config must be enabled. This config patch is available from SPE 5.1 and above.
@vtml
vtml / HedgehogDevelopment.TDS.targets
Last active September 11, 2019 06:12
Hedgehog Team Development for Sitecore (TDS) v5.8 Review
<!-- BEGIN: changes to exclude Hedgehog DLL's during Web Deploy package generation -->
<Copy SourceFiles="$(MSBuildThisFileDirectory)HedgehogDevelopment.SitecoreProject.WebDeployClient.dll" DestinationFolder="$(_OutputPath)\Bin" Condition="'$(WebDeployPackageCodeAndItemOptions)' != 'CodeOnly' and '$(SkipHedgehogDLLs)' != 'True'" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)HedgehogDevelopment.SitecoreProject.PackageInstallPostProcessor.dll" DestinationFolder="$(_OutputPath)\Bin" SkipUnchangedFiles="true" Condition="'$(WebDeployPackageCodeAndItemOptions)' != 'CodeOnly' and '$(SkipHedgehogDLLs)' != 'True'" />
<!-- END: changes to exclude Hedgehog DLL's during Web Deploy package generation -->
@vtml
vtml / TdsGlobal.config
Created August 24, 2019 00:43
Hedgehog Team Development for Sitecore (TDS) v5.8 Review
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CompactSitecoreItemsInProjectFile>True</CompactSitecoreItemsInProjectFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<!--
In the default configuration of the global file, the values for a configuration in the global file supersede the values
in the project configuration. This behavior can be changed by specifying a condition on the property as follows:
@vtml
vtml / pipelinesPerRequest.js
Created July 5, 2019 08:47 — forked from richardszalay/pipelinesPerRequest.js
Sitecore Pipelines admin tool :: Per Request Wall Time Summary
/*
Paste this into the dev tools console on sitecore/admin/pipelines.aspx for a summary of pipeline execution time per request
*/
(function() {
function pipelinesPerRequest() {
const pipelines = Array.from(document.querySelectorAll('.groupheader')).map(el => ({
pipeline: el.querySelector("*[pln-name]").innerText,
executions: parseInt(el.querySelector('*[title="#Executions"]').innerText, 10),
wallTime: parseInt(el.querySelector('*[title="Wall Time"]').innerText.replace(/[^\d\.]/g, ''), 10)
}))
@vtml
vtml / TooLazyServiceConfigurator.cs
Created March 19, 2019 12:06
Sitecore Super Power Friendly Dependency Injection
using System.IO.Abstractions;
using System.Reflection;
using FileHelpers;
using Isobar.Foundation.DependencyInjection;
using Isobar.Foundation.SitecoreUtilities.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Sitecore.DependencyInjection;
namespace Isobar.SampleProject.Infrastructure