Skip to content

Instantly share code, notes, and snippets.

View nickwesselman's full-sized avatar

Nick Wesselman nickwesselman

View GitHub Profile
@nickwesselman
nickwesselman / ConvertToNewNuget-packagesconfig.ps1
Last active November 6, 2019 14:03
Assists in updating an existing Sitecore Visual Studio solution to the new nuget structure for 9.1, when using packages.config style Nuget. This code is provided AS-IS, and is not supported by Sitecore.
## Nuget v2 URL for the target platform, and the target marketing version
$SitecoreNuget = "https://sitecore.myget.org/F/sc-platform-9-1/api/v2"
$TargetVersion = "9.1.0"
function Add-XMLAttribute([System.Xml.XmlNode] $Node, $Name, $Value)
{
$attrib = $Node.OwnerDocument.CreateAttribute($Name)
$attrib.Value = $Value
$node.Attributes.Append($attrib)
}
@nickwesselman
nickwesselman / Performance.Dev.config
Last active September 4, 2019 15:55 — forked from kamsar/Performance.Dev.config
Sitecore 9.0 Dev Performance Config
<!--
A set of performance optimizations for development that vastly increase application startup time.
Should not be used in production, as they largely disable forensic diagnostics that you'd want there over fast startup time after a compile.
-->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<hooks>
<hook type="Sitecore.Diagnostics.HealthMonitorHook, Sitecore.Kernel">
<patch:delete />
@nickwesselman
nickwesselman / GenerateProducts.ps1
Last active June 12, 2019 16:08
Generate Random Bucket Content for Sitecore with PowerShell Extensions and RandomText.me
$ErrorActionPreference = "Stop"
Function Get-Lorem($Minimum, $Maximum) {
# don't overrun randomtext.me
Start-Sleep -Milliseconds 300
$words = Get-Random -Minimum $Minimum -Maximum ($Maximum+1)
return ([xml](ConvertFrom-Json (Invoke-WebRequest -UseBasicParsing http://www.randomtext.me/api/lorem/h1/$words).Content).text_out).h1
}
Function Get-LoremUl($NumItems, $Minimum, $Maximum) {
@nickwesselman
nickwesselman / ConvertToNewNuget-PackageReference.ps1
Last active April 10, 2019 09:39
Assists in updating an existing Sitecore Visual Studio solution to the new nuget structure for 9.1, when using PackageReference style Nuget. This code is provided AS-IS, and is not supported by Sitecore.
## Nuget v2 URL for the target platform, and the target marketing version
$SitecoreNuget = "https://sitecore.myget.org/F/sc-platform-9-1/api/v2"
$TargetVersion = "9.1.0"
## Nuget URL to retrieve package metadata, including dependencies
$MetaPackage = "$SitecoreNuget/Packages(Id='Sitecore.Experience.Platform',Version='$TargetVersion')"
## Retrieve the package metadata from nuget (no nice way of doing this via CLI)
$PackageMetadata = [xml](Invoke-WebRequest $MetaPackage).Content
@nickwesselman
nickwesselman / 01-templates.sitecore.js
Created March 15, 2018 15:14
Sitecore Content Import via JSS Manifest
export default function(manifest) {
manifest.addTemplate({
name: 'Setlist',
icon: '/~/icon/office/32x32/earth_music.png',
fields: [
{ name: 'eventDate', type: 'Date' },
{ name: 'artist', type: manifest.fieldTypes.singleLineText },
{ name: 'venue', type: manifest.fieldTypes.singleLineText },
{ name: 'location', type: manifest.fieldTypes.singleLineText },
{ name: 'description', type: manifest.fieldTypes.richText },
@nickwesselman
nickwesselman / item-odata.js
Last active February 27, 2018 13:00
Headless on Sitecore 9 Examples
/* Using the Sitecore 9 Item OData service with odata.js */
var o = require('odata');
var moment = require('moment');
o().config({
endpoint: 'http://symheadless.local/sitecore/api/ssc/aggregate/content/',
appending: [
{ name: 'sc_apikey', value: 'D510CB0F-B2EF-4224-8F7A-7F04C020BDFE' }
]