Skip to content

Instantly share code, notes, and snippets.

@davidisnotnull
davidisnotnull / create-admin-user-optimizely-12.md
Created September 5, 2023 14:32
Creating an admin user in Optimizely 12

Install the EpiServer.Templates package globally

dotnet new install EPiServer.Templates

Then install the optional EpiServer CLI tools

dotnet tool install Episerver.Net.CLI -g --add-source https://nuget.optimizely.com/feed/packages.svc/
@michaellwest
michaellwest / CurlCMError.ps1
Created January 16, 2023 21:01
Curl the home page when the CM reports unhealthy. For use with Sitecore and Docker.
$containers = docker ps -a --format "table {{.Names}}"
$container = $containers | ConvertFrom-Csv | Where-Object { $_.NAMES -match "-cm" } | Select-Object -First 1 -ExpandProperty NAMES
docker exec $container curl http://cm
@Antonytm
Antonytm / pre-commit.sh
Created August 27, 2022 10:59
Pre-commit Git hook that validates Sitecore serialization
#!/bin/sh
# Pre-commit Git hook
# It runs Sitecore CLI Serialization check
# And doesn't allow to perform commit if serialization is broken
validate=$(dotnet sitecore ser validate)
regex_errors="Errors were detected"
count=$(echo "${validate}" | grep -c "${regex_errors}")
if test $count -gt 0
then
echo "Sitecore serialization errors were detected"
@Antonytm
Antonytm / JssFieldsExtender.cs
Last active August 3, 2022 20:47 — forked from IvanLieckens/JssFieldsExtender.cs
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;
@noslin005
noslin005 / ofed-ubuntu.sh
Created June 23, 2021 12:31
Install Mellanox Ofed on Ubuntu Machines
#!/bin/bash
# ofed-ubuntu.sh
# Install Mellanox Ofed on Ubuntu Machines
#
# Author: Nilson Lopes (06/17/2021)
ubuntu_release=$(awk -F '"' '/VERSION_ID/ {print $2}' /etc/os-release)
mofed_package_version='latest'
mofed_repo_base_url="https://linux.mellanox.com/public/repo/mlnx_ofed"
@auzick
auzick / LinkExtensions.cs
Created November 10, 2020 13:11
Sitecore SXA Scriban extension to expose the innards of a link field
using Scriban.Runtime;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.XA.Foundation.Abstractions;
using Sitecore.XA.Foundation.Scriban.Pipelines.GenerateScribanContext;
using System;
using Example.ScribanExtensions.Model;
namespace Example.ScribanExtensions.Pipelines
{
@alexshyba
alexshyba / CustomHead.tsx
Created November 9, 2020 19:32
Disabling Next.js scripts, `NEXT_DATA` and React rehydration
import React from 'react';
import { Head } from 'next/document';
import { cleanAmpPath } from 'next/dist/next-server/server/utils'
function getOptionalModernScriptVariant(path: string) {
if (process.env.__NEXT_MODERN_BUILD) {
return path.replace(/\.js$/, '.module.js')
}
return path
}
@michaellwest
michaellwest / CleanupBlobData.sql
Created September 24, 2019 16:03
Cleanup orphaned blob data using SSMS. When Sitecore runs this process it may timeout otherwise.
DECLARE @BlobID uniqueidentifier;
SELECT @BlobID = '{FF8A2D01-8A77-4F1B-A966-65806993CD31}';
WITH [BlobFields] ([fieldid])
AS (SELECT [sharedfields].[itemid]
FROM [sharedfields]
WHERE [sharedfields].[fieldid] = @BlobID
AND [sharedfields].[value] = 1
UNION
SELECT [versionedfields].[itemid]
@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;
@JakubOboza
JakubOboza / private-docker-regs-with-free-tiers.markdown
Created May 30, 2019 07:15
Private Docker registry with free tiers for Developers.

List of sites with free tier limits

  • Docker Hub - One private repo/image spot for free
  • Three Scale - Very generous free tier 50GB of space, 500 Pulls a month etc..
  • Canister - 20 private repos with almost no limits on free tier
  • Code Fresh - Free tier for developers

Setup your own private registry