Skip to content

Instantly share code, notes, and snippets.

View vtml's full-sized avatar

Vincent Lui vtml

View GitHub Profile
@vtml
vtml / UrlRewritesAndRedirects.config
Created September 19, 2018 23:55
Custom Culture URL Rewrite Rule
<rule name="RewriteCustomCultures" enabled="true">
 <match url="^(/?)en-(jp)(/?)(.*)?" />
 <action type="Rewrite" url="en-{CustomCultures:{R:2}}/{R:4}" appendQueryString="true" />
 </rule>
@vtml
vtml / RewriteMaps.config
Created September 19, 2018 23:59
Rewrite Map for Custom Cultures
<rewriteMaps>
 <rewriteMap name="CustomCultures">
 <add key="jp" value="jm" />
 </rewriteMap>
</rewriteMaps>
@vtml
vtml / TdsGlobal.config
Last active December 5, 2018 04:43
Referencing T4 Code Generation Templates
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<!--
In the default configuration of the global file, the values for a configuration in the global file supersede the values
in the project configuration. This behavior can be changed by specifying a condition on the property as follows:
<SitecoreWebUrl Condition=" '$(SitecoreWebUrl)' == '' "></SitecoreWebUrl>
By adding the above condition, the value specified in the global configuration file will only be applied if the
@vtml
vtml / Whatever.TDS.scproj
Created October 31, 2018 12:18
TDS projects using Nuget package
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.2.0.2\build\Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.2.0.2\build\Hedgehog.TDS.BuildExtensions.GitDeltaDeploy.targets'))" />
<Error Condition="!Exists('..\packages\HedgehogDevelopment.TDS.5.7.0.10\build\HedgehogDevelopment.TDS.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\HedgehogDevelopment.TDS.5.7.0.10\build\HedgehogDevelopment.TDS.targets'))" />
</Target>
<Import Project="..\packages\HedgehogDevelopment.TDS.5
@vtml
vtml / VS Build Scripts\DeveloperTdsBuild.bat
Created October 31, 2018 12:43
Building a TDS Package on a Developer's workstation
@echo off
:: global parameters
set msbuild="C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
set solution="..\Some.Sitecore.sln"
echo Please enter a Git Commit Hash, leaving it empty to build the entire TDS packages.
set GitCommitId =
set /P GitCommitId=
If "%GitCommitId%" == "" GOTO BuildFullTds
@vtml
vtml / PackageInstallerFunction.ps1
Last active October 31, 2018 12:56
Package Installer
function PackageInstall($WebSiteFolder, $PSScriptRoot, $sitecoreUrl)
{
#build tds projects
& "..\\VS Build Scripts\\DeveloperTdsBuild.bat"
#set package installer paths
$RepoDir = Split-Path $PSScriptRoot -parent
$parentDir = Split-Path $RepoDir -parent
$TDSPackagesFolder = $RepoDir + "\TDSPackages"
$PackageInstallerExePath = $RepoDir + "\TdsPackageInstaller\PackageInstaller.exe"
@vtml
vtml / PackageInstaller.ps1
Created October 31, 2018 12:57
Gluing the whole Developer Workstation TDS Install Process together
.".\PackageInstallerFunction.ps1"
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
PackageInstall "Website" $PSScriptRoot "https:\\some.website"
@vtml
vtml / Determining Last Successful Build Git Commit Hash
Created October 31, 2018 13:21
TeamCity Build Step to determine last successful build Git Commit ID
######################################################
# Retrieves the last successful build of a TeamCity Project
# Finding the Commit Hash
# http://blogs.lessthandot.com/index.php/uncategorized/access-git-commits-during-a-teamcity-build-using-powershell/
######################################################
function Get-TeamCityLastSuccessfulRun([string] $TeamCityUrl, [string] $TeamCityBuildTypeId, [string] $TeamCityUsername, [string] $TeamCityPassword)
{
$Credentials = "$($TeamCityUsername):$($TeamCityPassword)"
$AuthString = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("$Credentials"))
param(
[string] $LastGitCommitId,
[string] $AccessToken,
[string] $AzureDevOpsAccountName,
[string] $TeamProjectId,
[string] $ReleaseDefinitionId
)
if ([string]::IsNullOrEmpty($LastGitCommitId))
{
$hdrs = @{}
@vtml
vtml / Sitecore.HistoryEngine.config
Created January 11, 2019 11:36
Sitecore 9.x History Engine Configuration
<?xml version="1.0" encoding="utf-8" ?>
<!--
Purpose: This include file enables the History Engine for Sitecore databases.
To enable this include file, rename it to have a ".config" extension.
-->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>