Skip to content

Instantly share code, notes, and snippets.

@bic742
bic742 / Get-PathsFromTds.ps1
Created August 9, 2023 13:45
This is a PowerShell script that will parse TDS scproj files and generate corresponding SCS module.json files. This process includes consolidation of paths to prevent overly prescriptive configurations. It also supports providing path exclusions to ignore things that should no longer be tracked in a newer tool.
Param(
[string]$srcPath
)
function Invoke-DedupeOutput {
Param(
[System.Collections.ArrayList]$includes
)
$dedupedIncludes = [System.Collections.ArrayList]@()
$datasource = Get-Item .
$referrers = $datasource | Get-ItemReferrer
$pageOnlyReferrers = $referrers | Where-Object { $_.Name -ne '__Standard Values' } | Sort-Object -Property Name -Unique
$pageOnlyReferrers = $pageOnlyReferrers | Where-Object { $_.Paths.Path -like '/sitecore/content/{site-node}' }
if ($pageOnlyReferrers.Count -eq 0) {
return;
}
@cassidydotdk
cassidydotdk / Build.ps1
Last active May 23, 2021 06:01
Complete Build and Publish Script. Will deploy all projects to publishing target, no HPP required.
param(
[Parameter()]
[switch]$NoBuild,
[Parameter()]
[switch]$NoSync,
[Parameter()]
[string]$CmHost="https://habitatstarterkit.local",
[Parameter()]
[string]$SolutionName="HabitatStarterKit.sln",
[Parameter()]
@aweber1
aweber1 / __readme.md
Last active February 27, 2021 02:38
JSS Rendering Host

Description

The files in this gist demonstrate a fairly basic setup for a JSS rendering host.

DISCLAIMER: No guarantees that the code actually runs as-is. It was largely edited in place, so there may be typos or small syntax errors that you'll need to correct in your editor of choice. Feel free to leave a comment with any necessary fixes.

  • Sitecore config: jss-app-config.config This file is meant to show you how to setup your app config to use an external rendering host.

  • Entry point: jss-rendering-host-tunnel.js

@cassidydotdk
cassidydotdk / gulp-config.js
Last active January 31, 2023 15:49
Task to build and publish a .SLN file from gulp using "msbuild" instead of "gulp-msbuild". Version 16.0 for VS2019, use 15.0 for VS2017.
module.exports = function () {
var config = {
websiteRoot: "C:\\inetpub\\wwwroot\\sc911.sc",
sitecoreLibraries: "C:\\inetpub\\wwwroot\\sc911.sc\\bin",
hostName: "http://sc911.sc",
solutionName: "sc911",
buildConfiguration: "Debug",
runCleanBuilds: false,
toolsVersion: "16.0"
}
@michaellwest
michaellwest / CopyContentWithRainbow.ps1
Last active November 6, 2018 17:19
Sitecore PowerShell Extensions example transferring items between servers using rainbow serialization and spe remoting. You will want to be using SPE 5.1 or newer when transferring media items.
Import-Module -Name "SPE"
$session = New-ScriptSession -user "admin" -pass "b" -conn "https://spe-a"
$yaml = Invoke-RemoteScript -ScriptBlock {
$homeId = "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
Get-ChildItem -Path "master:" -ID $homeId -WithParent -Recurse |
ConvertTo-RainbowYaml
} -Session $session
$session2 = New-ScriptSession -user "admin" -pass "b" -conn "https://spe-b"
@jraps20
jraps20 / GetDatasourceDependencies.cs
Last active January 12, 2018 22:17
Full set of classes and config changes required to index modular content in Sitecore, i.e. content that is added to the page as a separate rendering with a datasource. Configured to only index certain renderings based on config, to disallow indexing of renderings that may be "Related Items" or other types of renderings that are shared and not pe…
using System.Linq;
using Sitecore;
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.Pipelines.GetDependencies;
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
namespace Common.Sitecore.Search.GetDependencies
{
@blacktambourine
blacktambourine / JsonIndexableItem.cs
Created November 10, 2017 06:00
Custom Indexable item type for my non-sitecore data
using System;
using System.Collections.Generic;
using System.Globalization;
using MyCustomModels.Flights.Model;
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.Converters;
using Sitecore.Data;
using Sitecore.Diagnostics;
namespace Business.Search.Json
@tinogomes
tinogomes / DNS_TO_LOCALHOST.markdown
Last active June 21, 2024 23:18
Public DNS Pointing to localhost (127.0.0.1)

Available Public Wildcard DNS Domains pointing to localhost (127.0.0.1)

The best way to safely and securely use local domains pointing to 127.0.0.1 is to edit your local settings (/etc/hosts) and add your own settings. Keep in mind if you want to use subdomains, you need to enter all variations.

Example:

# Adding bottom of your current file /etc/hosts
################# MY LOCAL DOMAINS
127.0.0.1 local.com admin.local.com
127.0.0.1 domain1.com