Skip to content

Instantly share code, notes, and snippets.

View feanz's full-sized avatar

Richard Forrest feanz

View GitHub Profile
@feanz
feanz / settings.json
Last active October 16, 2021 07:02
Windows Terminal Settings
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command":
{
"action": "copy",
"singleLine": false
},
@feanz
feanz / numbertowords.cs
Created March 17, 2020 10:37
Number to words
public static string NumberToWords(int number)
{
if (number == 0)
return "zero";
if (number < 0)
return "minus " + NumberToWords(Math.Abs(number));
string words = "";
@feanz
feanz / copy-language.ps1
Created February 27, 2020 10:54
Copy sitecore site language. A a new language version to all items in a site in sitecore powershell
Import-Function CommonFunctions
$siteDropdownList = Get-Sites
$languageDropdownList = Get-Languages
$addVersionBehaviourList = [ordered]@{Overwrite="Overwrite"; Skip="Skip"; Append="Append"};
$addVersionBehaviour = "Append"
$props = @{
Parameters = @(
@feanz
feanz / copy-site.ps1
Last active February 27, 2020 10:54
Copy sitecore site with a new lanaguage in sitecore powershell
Import-Function CommonFunctions
$siteDropdownList = Get-Sites
$languageDropdownList = Get-Languages
$props = @{
Parameters = @(
@{Name="sourceSitePath"; Title="Choose a source site"; Options=$siteDropdownList; Tooltip="Choose one."},
@{Name="sourceLanguage"; Title="Choose a source language"; Options=$languageDropdownList; Tooltip="Choose one."},
@{Name="destinationSiteName"; Title="Provide a destination site name"; Value=""; Tooltip="Choose a new site name."},
@feanz
feanz / add-language-to-collection-schema.ps1
Created February 19, 2020 15:52
Add a new language to a solr collection schema
# All cores use the same index config on remote servers so you should only have to add it to a single core. However locally each core uses a diff config set
$solrHost = "localhost:8985"
$index = "search_master_index"
$ignoreSslErrors = $True
$addFieldTypeJson = @'
{
"add-field-type": {
"name":"text_ko",
"class":"solr.TextField",
"analyzer":{
@feanz
feanz / WebSecondary.config
Last active February 19, 2020 10:21
Config for a secondary publishing target in sitecore
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<eventing defaultProvider="sitecore">
<eventQueueProvider defaultEventQueue="core">
<eventQueue name="web_secondary" patch:after="eventQueue[@name='web']" type="Sitecore.Data.Eventing.$(database)EventQueue, Sitecore.Kernel">
<param ref="dataApis/dataApi[@name='$(database)']" param1="$(name)" />
<param hint="" ref="PropertyStoreProvider/store[@name='$(name)']" />
</eventQueue>
</eventQueueProvider>
@feanz
feanz / switchonrebuild.config
Last active March 2, 2020 16:15
Sitecore switch on rebuild index for cloud
<?xml version="1.0"?>
<!--For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"
xmlns:env="http://www.sitecore.net/xmlconfig/env/"
xmlns:role="http://www.sitecore.net/xmlconfig/role/"
xmlns:search="http://www.sitecore.net/xmlconfig/search/"
xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<sitecore search:require="Solr">
<contentSearch env:require="!Local">
<solrOperationsFactory type="Sitecore.ContentSearch.SolrProvider.SolrOperations.SolrOperationsFactory, Sitecore.ContentSearch.SolrProvider" />
@feanz
feanz / healthcheck.aspx
Last active February 10, 2020 10:47
A health check page that will run checks for
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Diagnostics" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="Sitecore.ContentSearch" %>
<%@ Import Namespace="Sitecore.Data" %>
<%@ Import Namespace="Sitecore.Data.Items" %>
<%@ Import Namespace="StackExchange.Redis" %>
<%@ Import Namespace="System.Collections.Concurrent" %>
Set-StrictMode -Version Latest
#change these values to your own setup
$webhockUrl = "Slack Web hock"
$teamcityUsername = "username"
$teamcityPassword = "password"
$teamcityUrl = "teamcity URL"
$teamcityBuildNumber = %build.number%
$teamcityBuildId = %teamcity.build.id%
[Serializable]
public class ExportSearchToFile : Command
{
private string _linkToFile = string.Empty;
public override void Execute(CommandContext context)
{
if (context.Items.Length == 0)
return;
Item obj = context.Items[0];