Skip to content

Instantly share code, notes, and snippets.

View sebastiantecsi's full-sized avatar

Sebastian Tecsi sebastiantecsi

View GitHub Profile
@bic742
bic742 / Update-SolutionNugetReferences
Created January 25, 2023 15:01
This script can be used to update all Nuget references in a Helix solution. This is useful for cases where there are many projects and manually updating the references would take a lot of time. This script has to be executed via the Package Manager Console in Visual Studio.
$projects = Get-ChildItem -Path "C:\{solution_dir}\src" -Filter *csproj -Recurse | ForEach-Object { $project = $_; $packages = Select-Xml -Path "$($project.Directory.FullName)/packages.config" -XPath '/packages/package' | ForEach-Object { if ($_.Node.id -like "Sitecore*" -and $_.Node.version -eq "9.1.1") { Install-Package $_.Node.id -Project $project.BaseName -Version "10.2.0" -IgnoreDependencies } } }
@bic742
bic742 / Find-ProjectAssemblyVersions.ps1
Created January 25, 2023 14:59
This PowerShell script will scan all projects in a given solution for specific assembly and output the project name + assembly version when found. This is intended to be used to locate where a rogue assembly may be coming from in your running environment and get the version aligned with the rest of the system.
$searchPath = "C:\my_repo\src"
$assemblyName = "Sitecore.Horizon.Integration"
$versionPathMap = @{}
$files = Get-ChildItem -Path $searchPath -Recurse |
Where-Object { $_.Name -eq "$assemblyName.dll" }
foreach ($file in $files) {
$versionPathMap.Add($file.FullName, [Reflection.AssemblyName]::GetAssemblyName($file.FullName).Version)
}
namespace MyClient.Foundation.Services
{
using Sitecore.Data.Items;
using Sitecore.ExperienceEdge.Connector.Abstraction.DirectPublishing;
public class EdgeService : IEdgeService
{
private const string EdgePublishingTargetId = "{3013BEED-71CA-4DE3-A1D2-17DD871597F1}";
/// <summary>
# 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++
@marcelgruber
marcelgruber / [[...path]].ts
Last active January 29, 2023 13:42
NextJS Sitecore JSS Layout Service Response Shortcut URL
// This code makes it easier to ping your layout service without having to remember the long URL that is accessible by default.
// Add this file to /pages/api/viewpage or wherever you want.
// From there, all you need to do is visit /api/viewpage to view the layout service response for your home page
// Subpage would be /api/viewpage/someSubPage
// Note that this will be PUBLICLY VIEWABLE, so make sure to lock it down somehow, possibly with this or WAF rules:
// https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/walkthrough--creating-a-user-and-page-for-testing-sitecore-authentication.html
import type { NextApiRequest, NextApiResponse } from 'next';
const handler = async (req: NextApiRequest, res: NextApiResponse): Promise<void> => {
@agehlot
agehlot / sonarqube-command.cmd
Created November 9, 2022 14:34
CLI command to execute sonar qube execution
Sitecore Cloud
=============================================================================================
SonarScanner.MSBuild.exe begin /o:"app-one" /k:"sitecore-001" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="9d25b5f7c3efdb14a07da6f580932c94f00403aa"
MsBuild.exe Sitecore-Review.sln /t:Rebuild
SonarScanner.MSBuild.exe end /d:sonar.login="9d25b5f7c3efdb14a07da6f580932c94f00403aa"insert into NotificationQueue(UniqueId, ItemPublishQueueUniqueId, UserId, DealInLikedCategory, IsProcessed, NotificationMessageUniqueId, DateCreated, DateChanged)values(NEWID(), NEWID(), '5bc1ce12-f365-46c2-ba8f-d01ba43e66c1', 1, 0, '8a90352e-1409-4810-80e1-007262f3b7f5', '2008-11-11', '2008-11-11')
@michaellwest
michaellwest / CompareFieldChanges.ps1
Last active February 3, 2023 15:18
The following Sitecore PowerShell Extensions script finds items stored in the IAR files that also exist in the database.
function Get-ModifiedItem {
param(
$databaseName,
$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
@gillissm
gillissm / Add-SecureSiteBindings.ps1
Last active January 29, 2023 13:45
**Add-SecureSiteBinding** script has been created to provide the ability to add one or more domains to an IIS website each tied to a self-signed certificate providing SSL capabilities. The script contains three parts which I'll review, the full script can be found in the [Add-SecureSiteBindings Gist](GIST URL).
#Requires -RunAsAdministrator
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true,
Position=0,
HelpMessage = "Name of the IIS Site the new URLs should be associated to")]
[ValidateNotNullOrEmpty()]
[string]
@alan-null
alan-null / reclaimWindows10.ps1
Created October 16, 2021 20:14 — forked from alirobe/reclaimWindows10.ps1
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Modified by: alirobe <alirobe@alirobe.com> based on my personal preferences.
# Version: 2.20.2, 2018-09-14
# Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
# Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/
# Tweak difference:
#
# @alirobe's version is a subset focused on safely disabling telemetry, some 'smart' features and 3rd party bloat ...
@jbreuer
jbreuer / HybridPlaceholder.jsx
Last active July 22, 2021 13:17
Hybrid Placeholder
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,
}) => {