Skip to content

Instantly share code, notes, and snippets.

@techphoria414
techphoria414 / AllTemplatesField.cs
Last active December 15, 2017 02:43
A couple Sitecore 7 computed fields
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.ComputedFields;
using Sitecore.ContentSearch.Utilities;
using Sitecore.Data.Items;
@techphoria414
techphoria414 / rewrite-dates.ps1
Last active September 9, 2016 01:51
Rewrite interaction dates in Sitecore analytics database
$ErrorActionPreference = "Stop"
import-module mdbc
#
# Configuration Values
#
# The date you created the traffic which you wish to rewrite. Likely today.
$rewriteDate = Get-Date "9/8/2016"
@techphoria414
techphoria414 / ItemProviderScenarios.cs
Created November 16, 2013 22:41
Sitecore ItemProvider does not provide 100% coverage for manipulating data behavior. You potentially need to implement both an ItemProvider and a GetItemCommand, or just the latter.
//ItemProvider works via GetItem override
Sitecore.Context.Database.Items[Sitecore.Data.ID.Parse("{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}")].Children;
//ItemProvider works via GetChildren override
Sitecore.Data.Items.Item[] items = Sitecore.Context.Database.SelectItems("/sitecore/content/Home/*[@__isFolder='1']");
//ItemProvider doesn’t work, never called
items = Sitecore.Context.Database.SelectItems("/sitecore/content/Home/*");
//ItemProvider doesn’t work, never called
@techphoria414
techphoria414 / AllTemplatesField.cs
Last active December 27, 2015 15:09
Sitecore7 computed index field for *really* indexing all base templates (up to the Standard Template)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.ComputedFields;
using Sitecore.ContentSearch.Utilities;
using Sitecore.Data.Items;
@techphoria414
techphoria414 / html5example
Last active December 22, 2015 01:48
HTML5 Video Tag with mp4 and webm
<video id="video-player" class="video-js vjs-default-skin"
controls preload="auto" width="640" height="360"
poster="poster.jpg"
data-setup=''>
<source src="test_01_720.webm" type='video/webm' />
<source src="test_01_720.mp4" type='video/mp4' />
</video>
@techphoria414
techphoria414 / create-package-script-from-xml.ps1
Last active August 29, 2015 14:25
Script to take a Sitecore Package XML definition and output a Sitecore Powershell Extensions script to replace it.
Param (
[Parameter(Mandatory=$True)]
[string]$PackageXml = $null,
[Parameter(Mandatory=$True)]
[string]$SitecoreUri = $null
)
Import-Module -Name SPE
set-alias out Write-Output
@techphoria414
techphoria414 / 0_reuse_code.js
Created March 13, 2014 21:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console