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 / grid.css
Last active May 1, 2024 00:53
Sitecore Headless SXA Tailwind Grid-Only
@tailwind utilities;
.offset-0 {
margin-left: 0;
}
.offset-1 {
margin-left: 8.33333%;
}
@georgechang
georgechang / death.scriban
Last active February 10, 2023 18:01
This is why we can't have nice things
{{
# Get all pages that are nested under the root
# Check if it has a layout (avoids data source object)
# Set flag to true. Show everything if no filter is set.
# Get page filters. If a section has filters, set taxonomy flag to false. At least one field must match selected filters. Set to true #if we find a matching field.
# If the field parsing remains true after checking each field, add the item to an array.
# The array takes the item, and the date field parsed to that the date is a single number, year/month/day.
# After all field and array parsing is done, sort the array by date.
# Loop through the array and render the items.
@georgechang
georgechang / delete_zk_configs.sh
Last active September 27, 2022 17:26
Delete ZK configs
./server/scripts/cloud-scripts/zkcli.sh -cmd clear -z "zookeeper-service:2181" /configs/sitecore_core_index_config
./server/scripts/cloud-scripts/zkcli.sh -cmd clear -z "zookeeper-service:2181" /configs/sitecore_fxm_master_index_config
./server/scripts/cloud-scripts/zkcli.sh -cmd clear -z "zookeeper-service:2181" /configs/sitecore_fxm_web_index_config
./server/scripts/cloud-scripts/zkcli.sh -cmd clear -z "zookeeper-service:2181" /configs/sitecore_marketing_asset_index_master_config
./server/scripts/cloud-scripts/zkcli.sh -cmd clear -z "zookeeper-service:2181" /configs/sitecore_marketing_asset_index_web_config
./server/scripts/cloud-scripts/zkcli.sh -cmd clear -z "zookeeper-service:2181" /configs/sitecore_marketingdefinitions_master_config
./server/scripts/cloud-scripts/zkcli.sh -cmd clear -z "zookeeper-service:2181" /configs/sitecore_marketingdefinitions_web_config
./server/scripts/cloud-scripts/zkcli.sh -cmd clear -z "zookeeper-service:2181" /configs/sitecore_master_index_config
./server/scripts/cloud-script
@georgechang
georgechang / gist:03baacfa59444d036ad554041c987e69
Created August 25, 2022 01:57
Convert .update to zip package
ConvertTo-SCModuleWebDeployPackage -Path "C:\temp\scupdate.update" -Destination "C:\temp" -Force
@georgechang
georgechang / Dockerfile.Coveo
Created December 16, 2021 00:53
Coveo Assets Dockerfiles
ARG WINDOWS_VERSION
ARG WINDOWS_LTSC_VERSION
FROM mcr.microsoft.com/windows/servercore:${WINDOWS_LTSC_VERSION} as builder
ARG COVEO_VERSION=5.0.1039.1
ARG COVEO_PACKAGE_URL=https://static.cloud.coveo.com/coveoforsitecore/packages/v${COVEO_VERSION}/Coveo%20for%20Sitecore%2010.1%20${COVEO_VERSION}.scwdp.zip
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Write-Host ('Preparing Coveo...'); \
Write-Host ('Downloading {0}...' -f $env:COVEO_PACKAGE_URL); \
Invoke-WebRequest -Uri $env:COVEO_PACKAGE_URL -OutFile 'coveo.zip'; \
Write-Host 'Expanding...'; \
@georgechang
georgechang / client-cert.sh
Created July 18, 2021 19:20
Create client cert with openssl
# create new client key
openssl genrsa -out dhclient.key 2048
# create CSR from key
openssl req -new -key .\client.key -out client.csr
# create .key file from cert
openssl pkcs12 -in cert.p12 -nocerts -out cert.key -nodes
# create .pem file from cert
@georgechang
georgechang / New-TraefikCertificates.ps1
Last active April 3, 2021 15:46
Create crt/key files
New-SelfSignedCertificate -DnsName domain.com -CertStoreLocation Cert:\LocalMachine\My -KeyExportPolicy Exportable -NotAfter (Get-Date).AddYears(3) | Export-PfxCertificate -FilePath .\cert.pfx -Password (ConvertTo-SecureString -String "secret" -AsPlainText -Force)
openssl pkcs12 -in cert.pfx -nocerts -out cert.key
openssl pkcs12 -in cert.pfx -clcerts -nokeys -out cert.crt
@georgechang
georgechang / keybase.md
Last active December 29, 2020 23:33
Keybase

Keybase proof

I hereby claim:

  • I am georgechang on github.
  • I am georgechang (https://keybase.io/georgechang) on keybase.
  • I have a public key ASDYJpQ-q5RP4ocXafXBtAjBLIlkWSla3eUmn8KXWMXQKAo

To claim this, I am signing this object:

Git DMZ Flow

I've been asked a few times over the last few months to put together a full write-up of the Git workflow we use at RichRelevance (and at Precog before), since I have referenced it in passing quite a few times in tweets and in person. The workflow is appreciably different from GitFlow and its derivatives, and thus it brings with it a different set of tradeoffs and optimizations. To that end, it would probably be helpful to go over exactly what workflow benefits I find to be beneficial or even necessary.

  • Two developers working on independent features must never be blocked by each other
    • No code freeze! Ever! For any reason!
  • A developer must be able to base derivative work on another developer's work, without waiting for any third party
  • Two developers working on inter-dependent features (or even the same feature) must be able to do so without interference from (or interfering with) any other parties
  • Developers must be able to work on multiple features simultaneously, or at lea
@georgechang
georgechang / InitializeVueEE.js
Created March 12, 2020 20:11
conditional Vue initialization to accommodate for Experience Editor
// check if this is Experience Editor
if (typeof Sitecore !== typeof undefined &&
typeof Sitecore.PageModes !== typeof undefined &&
typeof Sitecore.PageModes.PageEditor !== typeof undefined) {
Sitecore.PageModes.PageEditor.onLoadComplete.observe(() => {
// add v-pre to all placeholder elements
document
.querySelectorAll("code[type='text/sitecore']")
.forEach(ph => ph.setAttribute('v-pre', ''));