Skip to content

Instantly share code, notes, and snippets.

View sebastiantecsi's full-sized avatar

Sebastian Tecsi sebastiantecsi

View GitHub Profile
# Root path to look 'orphan' items under - update here as needed
cd 'master:/sitecore/media library'
$counter = 0
$itemsToProcess = Get-ChildItem -Recurse . | Where-Object { $_.TemplateName -ne 'Media Folder' }
if ($itemsToProcess -ne $null) {
$itemsToProcess | ForEach-Object {
$referrers = Get-ItemReferrer -Item $_ | measure
if ($referrers.Count -eq 0) {
$counter++
@sebastiantecsi
sebastiantecsi / UnicornDependencyGraphGenerator.ps1
Created January 29, 2023 13:39 — forked from alan-null/UnicornDependencyGraphGenerator.ps1
Generate unicorn dependency graph using PowerShell. Analyse and improve your configurations or easily fix existing issues
function Get-ComputedDependencyGraphUrl {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0 )]
[Hashtable]$allDependenciesClean
)
begin {
Write-Verbose "Cmdlet Get-ComputedDependencyGraphUrl - Begin"
}
@sebastiantecsi
sebastiantecsi / Delete.ps1
Created January 29, 2023 13:35 — forked from michaellwest/CompareFieldChanges.ps1
The following Sitecore PowerShell Extensions script finds items stored in the IAR files that also exist in the database.
$databaseName = $actionData["databaseName"]
$filename = $actionData["filename"]
$resourceLoaderType = ([System.Type]::GetType("Sitecore.Data.DataProviders.ReadOnly.Protobuf.IResourceLoader, Sitecore.Data.ResourceItems.ProtobufNet"))
$resourceLoader = [Sitecore.DependencyInjection.ServiceLocator]::ServiceProvider.GetService($resourceLoaderType)
$paths = [System.Collections.Generic.List[String]]@()
$paths.Add([Sitecore.MainUtil]::MapPath("/App_Data/items/$($databaseName)/$($filename)")) > $null
$paths.Add([Sitecore.MainUtil]::MapPath("/sitecore modules/items/$($databaseName)/$($filename)")) > $null
$defaultFieldValues = New-Object -TypeName 'System.Collections.Generic.Dictionary[[guid], [string]]'
$database = [Sitecore.Configuration.Factory]::GetDatabase($databaseName)
@sebastiantecsi
sebastiantecsi / JssFieldsExtender.cs
Created January 12, 2023 05:16 — 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;
import React, { useEffect, useState } from 'react';
import { withSitecoreContext, dataApi, Placeholder } from '@sitecore-jss/sitecore-jss-react';
import { dataFetcher } from './dataFetcher';
import config from './temp/config';
const HybridPlaceholder = ({
name,
rendering,
sitecoreContext,
}) => {

This uses Chocolatey and Boxstarter to install a loadout for Sitecore/.NET development on a new computer. Click the link below to start a click-to-run that does all the things. It's that easy. Fork the gist and alter the link below to customize for your own usage!

Click here to start install

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="ContentManagement or ContentDelivery or Reporting or Processing">
<watchers>
<patch:delete />
</watchers>
</sitecore>
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:environment="http://www.sitecore.net/xmlconfig/environment/">
<sitecore>
<watchers environment:require="!DEV">
<patch:delete />
</watchers>
</sitecore>
</configuration>
<?xml version="1.0"?>
<!-- For more information on using Web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=301874 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1">
<system.webServer>
<modules>
<add type="Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel" xdt:Locator="Match(type)" xdt:Transform="Remove" />
<add type="Sitecore.IO.XslWatcher, Sitecore.Kernel" xdt:Locator="Match(type)" xdt:Transform="Remove" />
<add type="Sitecore.IO.LayoutWatcher, Sitecore.Kernel" xdt:Locator="Match(type)" xdt:Transform="Remove" />
<add type="Sitecore.Configuration.ConfigWatcher, Sitecore.Kernel" xdt:Locator="Match(type)" xdt:Transform="Remove" />
</modules>
@sebastiantecsi
sebastiantecsi / Solr-SingleDeveloper.ps1
Last active November 24, 2020 21:57
Sitecore 10 Solr 8.4.0 install
# The Prefix that will be used on SOLR, Website and Database instances.
$Prefix = "Demo"
# The root folder with the license file and WDP files.
$SCInstallRoot = "C:\ResourceFiles"
# Install Solr Single Developer
$SolrSingleDeveloperParams = @{
Path = "$SCInstallRoot\Solr-SingleDeveloper.json"
SolrInstallRoot = "c:\Solution\SolR840\SolR840-$Prefix"
SolrServicePrefix = $Prefix
SolrPort = "9999"