Skip to content

Instantly share code, notes, and snippets.

View georgechang's full-sized avatar
☁️
coming out of cloud retirement

George Chang georgechang

☁️
coming out of cloud retirement
View GitHub Profile
@georgechang
georgechang / GC.Foundation.Media.Svg.config
Last active February 27, 2020 13:58
Render SVG inline pipeline processor
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<pipelines>
<renderField>
<processor type="GC.Foundation.Media.Pipelines.GetSvgImageFieldValue, GC.Foundation.Media" patch:after="processor[@type='Sitecore.Pipelines.RenderField.GetImageFieldValue, Sitecore.Kernel']" />
</renderField>
</pipelines>
</sitecore>
</configuration>
@georgechang
georgechang / Microsoft.PowerShell_profile.ps1
Created November 28, 2019 01:35
Current PowerShell Profile
Import-Module cd-extras
Import-Module posh-git
Import-Module oh-my-posh
Import-Module PowerTab -ErrorAction SilentlyContinue
Import-Module PSColor
Set-Theme paradox
$global:PSColor.File.Executable.Color = 'Blue'
# setting the default user removes the 'user@machine' designation at the beginning of the prompt
$DefaultUser = 'George'
@georgechang
georgechang / ComponentViewModel.cs
Created August 27, 2019 16:16
Sitecore Controller Rendering
public class ComponentViewModel
{
// types are standard Sitecore field types
public TextField SingleLineText { get; set; }
public HtmlField RichText { get; set; }
public ImageField Image { get; set; }
public LinkField GeneralLink { get; set; }
public CheckboxField Checkbox { get; set; }
public LookupField Droplink { get; set; }
public string ExternalText { get; set; }
@georgechang
georgechang / Cleanup.sql
Created March 6, 2019 15:41
Sitecore Database Cleanup
/****** History ******/
delete FROM [YOURDATABASE_Core].[dbo].[History] where Created < DATEADD(HOUR, -12, GETDATE())
delete FROM [YOURDATABASE_Master].[dbo].[History] where Created < DATEADD(HOUR, -12, GETDATE())
delete FROM [YOURDATABASE_Web].[dbo].[History] where Created < DATEADD(HOUR, -12, GETDATE())
/****** Publishqueue ******/
delete FROM [YOURDATABASE_Core].[dbo].[PublishQueue] where Date < DATEADD(HOUR, -12, GETDATE());
delete FROM [YOURDATABASE_Master].[dbo].[PublishQueue] where Date < DATEADD(HOUR, -12, GETDATE());
delete FROM [YOURDATABASE_Web].[dbo].[PublishQueue] where Date < DATEADD(HOUR, -12, GETDATE());
@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
@georgechang
georgechang / azuredeploy.json
Last active October 28, 2018 03:49
Generic Sitecore ARM Template
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {
"webApiVersion": "2016-08-01",
"sqlServerFqdnTidy": "[trim(toLower(parameters('sqlServerFqdn')))]",
"coreSqlDatabaseNameTidy": "[toLower(trim(parameters('coreSqlDatabaseName')))]",
"masterSqlDatabaseNameTidy": "[toLower(trim(parameters('masterSqlDatabaseName')))]",
@georgechang
georgechang / GC.Foundation.Search.CertificateAuth.config
Created August 1, 2018 01:42
GC.Foundation.Search.CertificateAuth.config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
<sitecore search:require="solr" role:require="ContentManagement or ContentDelivery">
<contentSearch>
<indexConfigurations>
<solrHttpWebRequestFactory type="GC.Foundation.Search.Solr.ClientCertificateHttpWebRequestFactory, GC.Foundation.Search">
<param hint="thumbprint">{CertificateThumbprint}</param>
</solrHttpWebRequestFactory>
</indexConfigurations>
</contentSearch>
</sitecore>
@georgechang
georgechang / ClientCertificateHttpWebRequestFactory.cs
Last active August 2, 2018 01:19
ClientCertificateHttpWebRequestFactory.cs
using System;
using System.Net;
using HttpWebAdapters;
using HttpWebAdapters.Adapters;
using System.Security.Cryptography.X509Certificates;
namespace GC.Foundation.Search.Solr
{
public class ClientCertificateHttpWebRequestFactory : IHttpWebRequestFactory
{
@georgechang
georgechang / DropSitecore9Databases.sql
Last active July 9, 2019 20:58
Drop all Sitecore 9 databases
DROP DATABASE [prefix_Core]
DROP DATABASE [prefix_EXM.Master]
DROP DATABASE [prefix_ExperienceForms]
DROP DATABASE [prefix_MarketingAutomation]
DROP DATABASE [prefix_Master]
DROP DATABASE [prefix_Messaging]
DROP DATABASE [prefix_Processing.Pools]
DROP DATABASE [prefix_Processing.Tasks]
DROP DATABASE [prefix_ProcessingEngineStorage]
DROP DATABASE [prefix_ProcessingEngineTasks]
using System;
using System.IdentityModel.Metadata;
using System.Security.Claims;
using Owin;
using Sitecore.Configuration;
using Sitecore.Owin.Authentication.Configuration;
using Sitecore.Owin.Authentication.Extensions;
using Sitecore.Owin.Authentication.Pipelines.IdentityProviders;
using Sitecore.Owin.Authentication.Services;
using Sustainsys.Saml2.Configuration;