Skip to content

Instantly share code, notes, and snippets.

View sebastiantecsi's full-sized avatar

Sebastian Tecsi sebastiantecsi

View GitHub Profile
@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;
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="Sitecore.Configuration" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Xml" %>
<%
XmlDocument configuration = Factory.GetConfiguration();
Response.ContentType = "application/xml";
Response.Write(configuration.OuterXml);
<?xml version="1.0" encoding="utf-8" ?>
<MergeToolChooserConfig>
<!-- Params are sent from %USERPROFILE%\.gitconfig
Typically (as shown in http://hedgehogdevelopment.github.io/tds/chapter4.html#configuring-sitecore-item-merge-for-git-using-mergechooser) they are
\"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
which map to parameters $1, $2, $3, and $4 respectively.
But additional labels (for the window panes in the merge tools) may also be passed like
\"Local\" \"Remote\" \"Original then Merged Result (when selection is resolved)\"
which would map to parameters $5, $6 and $7 respectively -->
@georgechang
georgechang / Install-ScHostPackage.ps1
Last active April 1, 2020 11:26
Install a Sitecore Host plugin
<#
.SYNOPSIS
Installs a Sitecore Host plugin NuGet package to a Sitecore Host instance.
.DESCRIPTION
Sitecore Host plugins are distributed via NuGet packages and have specific requirements to where assets are deployed. This will extract the files and place them in the correct directories depending on whether this is an application plugin or a runtime plugin.
.PARAMETER Path
@nickwesselman
nickwesselman / ConvertToNewNuget-packagesconfig.ps1
Last active November 6, 2019 14:03
Assists in updating an existing Sitecore Visual Studio solution to the new nuget structure for 9.1, when using packages.config style Nuget. This code is provided AS-IS, and is not supported by Sitecore.
## 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"
function Add-XMLAttribute([System.Xml.XmlNode] $Node, $Name, $Value)
{
$attrib = $Node.OwnerDocument.CreateAttribute($Name)
$attrib.Value = $Value
$node.Attributes.Append($attrib)
}
@kimcuhoang
kimcuhoang / install-sitecore-publishingservice.ps1
Last active November 26, 2021 14:16
A script to install Sitecore Publishing Service
[CmdletBinding()]
param(
[string] $SitecoreInstanceName = "habitathome",
[string] $PublishingServiceZipPackage = ".\Sitecore Publishing Service 3.1.1 rev. 180807-x64.zip",
[string] $WebrootPath = "D:\Inetpub\wwwroot",
[string] $SqlServerName = ".",
[string] $SqlAdminAccount = "sa",
[string] $SqlAdminPassword = 'The-password-for-sa-account',
[switch] $UpdateSchemasOnly
)
@BillCacy
BillCacy / BlueGreenSolrHelper.psm1
Last active July 27, 2021 13:57
Solr script to handle the CDCR replication switching during a Blue/Green deployment.
using module ".\BlueGreenSolrSettings.psm1"
$ErrorActionPreference = "Stop"
<#
.SYNOPSIS
Pushes the specified config and related pieces to the SolrCloud Zookeepers.
.PARAMETER solrPath
Path on the machine to the Solr installation.
EX: C:\solr\solr-6.2.1
@michaellwest
michaellwest / SPE-Dialog-With-Commands.ps1
Created October 7, 2018 02:30
Displays a dialog using Sitecore PowerShell Extensions.
# Be sure to update this ID to whichever script you want to execute when the link is clicked.
$scriptId = "{6EAF681D-5D87-4C43-B279-356A8B9A15CF}"
$item = Get-Item -Path "."
$script = Get-Item -Path "master:" -ID $scriptId
$command = "item:executescript(id=$($item.ID),db=$($item.Database.Name),script=$($script.ID),scriptDb=$($script.Database.Name))"
$options = [ordered]@{"Download Sample"=$command;"View Documentation"=$command;}
$props = @{
Parameters = @(
@pbering
pbering / Performance.config
Last active January 29, 2023 12:20
Sitecore Performance (Docker friendly)
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="Sitecore.Pipelines.Loader.ShowVersion, Sitecore.Kernel">
<patch:delete />
</processor>
<processor type="Sitecore.Pipelines.Loader.ShowHistory, Sitecore.Kernel">
<patch:delete />
</processor>
@coreyasmith
coreyasmith / New-TrustedSelfSignedCertificate.ps1
Last active January 29, 2023 13:31
Create a trusted, self-signed certificate with PowerShell. Inspiration comes from Dominick Baier's (@leastprivilege) "Web API v2 Security" course on Pluralsight: https://www.pluralsight.com/courses/webapi-v2-security.
Param(
[Parameter(Mandatory=$true)]
[string[]]$DnsName,
[DateTime]$CertExpirationDate = (Get-Date).AddYears(5),
[string]$PersonalCertStoreLocation = "Cert:\LocalMachine\My",
[string]$HashAlgorithm = "SHA512",
[string]$RootCertSubject = "CN=DevRoot",
[string]$RootCertStoreLocation = "Cert:\LocalMachine\Root",
[DateTime]$RootCertExpirationDate = (Get-Date).AddYears(20)
)