Skip to content

Instantly share code, notes, and snippets.

Richard Szalay richardszalay

Block or report user

Report or block richardszalay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@richardszalay
richardszalay / ConvertFrom-SxaSearchUrl.ps1
Created Aug 12, 2019
Convert SXA search API URLs to raw queries
View ConvertFrom-SxaSearchUrl.ps1
<#
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(
@richardszalay
richardszalay / pipelinesPerRequest.js
Created Jul 5, 2019
Sitecore Pipelines admin tool :: Per Request Wall Time Summary
View pipelinesPerRequest.js
/*
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)
}))
View ConvertFrom-XdbIndexToken.ps1
param(
[string]$Token = (Read-Host "Enter xdbtokenbytes_s value")
)
$bytes = [Convert]::FromBase64String($Token)
$ms = [System.IO.MemoryStream]::new($bytes, 0, $bytes.Length)
$bf = [System.Runtime.Serialization.Formatters.Binary.BinaryFormatter]::new()
$dict = $bf.Deserialize($ms);
Write-Output $dict
@richardszalay
richardszalay / IISAssemblyDebugging.psm1
Created Jun 14, 2019
Enable/Disable JIT optimizations for assemblies so they can be debugged with dnSpy
View IISAssemblyDebugging.psm1
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
function Enable-IISAssemblyDebugging
{
param(
[string]$Path = ".",
[string]$Filter = "*.dll"
)
View Connect-AzureVmRDP.ps1
<#
.SYNOPSIS
Connect to an Azure VM via RDP, starting it if it is not already running
.DESCRIPTION
VM credentials are cached to Credential Manager and won't be required after the first connect
.PARAMETER Subscription
The Azure Subscription that contains the VMS
.PARAMETER ResourceGroupName
@richardszalay
richardszalay / web-nfc.d.ts
Created Apr 8, 2019
Types for WebNFC as implemented by Chrome
View web-nfc.d.ts
/**
* Types for the version of Web NFC available in Chrome for Android
*
* The spec is similar to, but does not exactly match https://w3c.github.io/web-nfc/releases/20151112/
*/
declare global {
interface Navigator {
nfc: WebNFC
}
@richardszalay
richardszalay / ConvertToNewNuget-PackageReference.ps1
Created Nov 30, 2018 — forked from nickwesselman/ConvertToNewNuget-PackageReference.ps1
Assists in updating an existing Sitecore Visual Studio solution to the new nuget structure for 9.1, when using PackageReference style Nuget. This code is provided AS-IS, and is not supported by Sitecore.
View ConvertToNewNuget-PackageReference.ps1
## Nuget v2 URL for the target platform, and the target marketing version
$SitecoreNuget = "https://sitecore.myget.org/F/sc-platform-9-1/api/v2"
$TargetVersion = "9.1.0"
## Nuget URL to retrieve package metadata, including dependencies
$MetaPackage = "$SitecoreNuget/Packages(Id='Sitecore.Experience.Platform',Version='$TargetVersion')"
## Retrieve the package metadata from nuget (no nice way of doing this via CLI)
$PackageMetadata = [xml](Invoke-WebRequest $MetaPackage).Content
View Patch-SitecoreCommercePolicySet.ps1
<#
**Prototype**
Updates the properties of one or more Sitecore Commerce policies in a policy set or environment json file.
# Patch all policies from another file
Patch-SitecoreCommercePolicySet -Path "path\to\policy.json" -SourcePath "path\to\source.json"
# Patch a specific policy from another file
Patch-SitecoreCommercePolicySet -Path "path\to\policy.json" -SourcePath "path\to\source.json" -PolicyType "Fully.Qualified.Type, With.Assembly.But.Spaces.Are.Ignored"
@richardszalay
richardszalay / DiagnosticBlock.cs
Created May 15, 2018
DiagnosticBlock for Sitecore Commerce
View DiagnosticBlock.cs
/**
This block is designed to assist with diagnosing data/pipeline issues within Sitecore
Example:
services.Sitecore().Pipelines(config => config
.ConfigurePipeline<ICalculateSellableItemSellPricePipeline>(builder => builder
.Add<DiagnosticBlock<SellableItem>>("Before CalculateSellableItemListPriceBlock").Before<CalculateSellableItemSellPriceBlock>(),
order: 1001
)
View Invoke-SitecoreCommerceBootstrap.psm1
function Invoke-SitecoreCommerceBootstrap {
param(
[string]$Username = "sitecore\admin",
[string]$Password = "b",
[string]$IdentityServer = "https://localhost:5050",
[string]$OpsServer = "https://localhost:5015"
)
$ErrorActionPreference = "Stop"
You can’t perform that action at this time.