Skip to content

Instantly share code, notes, and snippets.

# Usage examples
# .\Set-DxAddon.ps1 -Url "http://server:83" -Path addon.zip
# .\Set-DxAddon.ps1 -Path addon.zip
param (
[parameter(Mandatory=$false, HelpMessage="Tridion DX Add-on service URL. Defaults to 'http://localhost:83'")]
[string] $Url = "http://localhost:83",
[parameter(Mandatory=$true, HelpMessage="Path to to the add-on.")]
[string] $Path
@jhorsman
jhorsman / gist:63676578b1376359a4337aa31417fbfe
Last active May 17, 2019 06:47 — forked from jpoehls/gist:2030795
Using CTRL+W to close tabs in Visual Studio

For Visual Studio 2017 (and other versions) with ReSharper

In Tools | Options | Environmen | Keyboard...

  1. Add CTRL+W as a Global shortcut for Window.CloseDocumentWindow
  2. Remove the CTRL+W shortcut for Edit.SelectCurrentWord
  3. Remove the CTRL+W shortcut from ReSharper.ReSharper_ExtendSelection (it might be assigned twice)

If CTRL+W does not work after the steps above, it might be assigned to something else. Check these instructions to troubleshoot that: https://gist.github.com/jpoehls/2030795#gistcomment-2335647

<!-- this XSLT is from the article schema in the core module from DXA 2.1 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" method="xml" cdata-section-elements="script"></xsl:output>
<xsl:template match="/ | node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="*[ (self::br or self::p or self::div) and normalize-space(translate(., &apos; &apos;, &apos;&apos;)) = &apos;&apos; and not(@*) and not(processing-instruction()) and not(comment()) and not(*[not(self::br) or @* or * or node()]) and not(following::node()[not( (self::text() or self::br or self::p or self::div) and normalize-space(translate(., &apos; &apos;, &apos;&apos;)) = &apos;&apos; and not(@*) and not(processing-instruction()) and not(comment()) and
# see https://git-scm.com/docs/git-clean
git clean -dxf
# -d Remove untracked directories in addition to untracked files.
# -x Don’t use the standard ignore rules read from .gitignore...
# -f force, Git will not remove files unless -f is set
@jhorsman
jhorsman / gist:82e2acde0f747fbcd21f6757943b09c7
Created January 29, 2019 09:19
Open Microsoft SQL Server Management Studio from the command line
# use this in case the management studio is not available in the Windows Start menu
ssms.exe
@jhorsman
jhorsman / purge-publishing-queue
Created January 4, 2019 14:05
Purge old Tridion Sites publishing transactions
# https://docs.sdl.com/LiveContent/content/en-US/SDL%20Web-v5/GUID-7BE8773F-B1AE-46D0-946E-CDD6F7C01DC7
Remove-TcmPublishTransactions -Succesful -Before (Get-Date).AddDays(-14)
@jhorsman
jhorsman / Restart-Docs.ps1
Created December 18, 2018 14:43
Script to restart SDL Tridion Docs content manager services. This covers the Windows services, component service and IIS application pools. Something similar can be done with the ISHDeploy module from https://github.com/sdl/ISHDeploy.
<#
.SYNOPSIS
Restarts Docs Content Manager services
.EXAMPLE
Restart-Docs
Restart-Docs -WindowsServices
Restart-Docs -ComponentServices
Restart-Docs -ApplicationPools
Restart-Docs -ComponentServices -ApplicationPools
@jhorsman
jhorsman / Test-ServerSSLSupport
Created November 7, 2018 21:31
Check which SSL/TLS versions are supported by a given hostname
function Test-ServerSSLSupport {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[string]$HostName,
[UInt16]$Port = 443
)
process {
$RetValue = New-Object psobject -Property @{
@jhorsman
jhorsman / Web.config
Created October 17, 2018 08:37
UDP service configuration in Web.config
<add key="discovery-service-uri" value="http://hostname:8082/discovery.svc" />
<add key="model-service-uri" value="http://hostname:8998" />
<add key="oauth-enabled" value="true" />
<add key="oauth-client-id" value="username" />
<add key="oauth-client-secret" value="password" />
@jhorsman
jhorsman / Encrypt-Config.ps1
Created October 3, 2018 21:41
Encrypt-Config.ps1: A PowerShell tool to encrypt or decrypt .NET app.config files
[CmdletBinding()]
Param(
[parameter(Mandatory=$false, HelpMessage="Encrypt the secure app settings")]
[switch]$Encrypt,
[parameter(Mandatory=$false, HelpMessage="Decrypt the secure app settings")]
[switch]$Decrypt
)
$ErrorActionPreference = "Stop"