Skip to content

Instantly share code, notes, and snippets.

public class ClearEdgeCacheHandler
{
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const string LastUpdateTimeKey = "ItemsPublishedEventHandler_LastUpdateTimeKey";
public void ItemsPublished(object sender, EventArgs args)
{
var now = DateTime.UtcNow;
var database = Factory.GetDatabase("web");
var fromDate = database.PropertyStore.GetDateValue(LastUpdateTimeKey, DateTime.MinValue.ToUniversalTime());
public class CacheControlProcessor : CacheControl
{
protected override void RunCacheControl(ActionExecutedArgs args)
{
Assert.IsNotNull(args, "args != null");
if (Sitecore.Context.Item != null)
{
if (HasRequestMethodGet(args) && DoesntHaveQuerystrings(args))
{
@cassidydotdk
cassidydotdk / Setup Unicorn in Docker.txt
Last active September 27, 2019 19:22
How to configure Unicorn with a volume mapping for your CM server Docker container
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.
@mikaelnet
mikaelnet / Broken links Report.ps1
Created August 21, 2019 12:31
Updated Sitecore SPE Broken links Report
@richardszalay
richardszalay / ConvertFrom-SxaSearchUrl.ps1
Created August 12, 2019 01:55
Convert SXA search API URLs to raw queries
<#
Converts an SXA search results API URL into the raw query sent to the provider
Example:
ConvertFrom-SxaSearchUrl (Read-Host "URL (eg. http://localhost/sxa/search/results?q=...)") | Format-List
#>
function ConvertFrom-SxaSearchUrl
{
param(
@jgamblin
jgamblin / vc-local.py
Created June 28, 2019 18:55
A Local Version of VulnerableContainers.org
import csv
import os
import re
import requests
import subprocess
import time
from datetime import timedelta
from more_itertools import unique_everseen
start = time.time()
@nickwesselman
nickwesselman / GenerateProducts.ps1
Last active June 12, 2019 16:08
Generate Random Bucket Content for Sitecore with PowerShell Extensions and RandomText.me
$ErrorActionPreference = "Stop"
Function Get-Lorem($Minimum, $Maximum) {
# don't overrun randomtext.me
Start-Sleep -Milliseconds 300
$words = Get-Random -Minimum $Minimum -Maximum ($Maximum+1)
return ([xml](ConvertFrom-Json (Invoke-WebRequest -UseBasicParsing http://www.randomtext.me/api/lorem/h1/$words).Content).text_out).h1
}
Function Get-LoremUl($NumItems, $Minimum, $Maximum) {
@JaimeStill
JaimeStill / README.md
Last active October 21, 2025 11:59
ASP.NET Core Active Directory Integration

Active Directory Authentication

This will provide an example of integrating Active Directory authentication in an ASP.NET Core app.

Note, you'll need to be running on a Windows domain with Visual Studio debugging in IIS Express for this to work.

Setup

In launchSettings.json, you'll want to modify iisSettings by turning on windowsAuthentication:

@vtml
vtml / Sitecore.HistoryEngine.config
Created January 11, 2019 11:36
Sitecore 9.x History Engine Configuration
<?xml version="1.0" encoding="utf-8" ?>
<!--
Purpose: This include file enables the History Engine for Sitecore databases.
To enable this include file, rename it to have a ".config" extension.
-->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
@AlexKasaku
AlexKasaku / Remove Site Language.ps1
Last active January 1, 2019 19:09
Remove a language from an SXA site. Based on the "Add Site Language" set of scripts that comes with SXA.
# Functions Site Language/Remove Site Language
Import-Function Validate-PowerShell
Test-PowerShell
Try
{
$ctx = Get-Item .