Skip to content

Instantly share code, notes, and snippets.

View kamsar's full-sized avatar
:shipit:
127.0.0.1

Kam Figy kamsar

:shipit:
127.0.0.1
View GitHub Profile
@kamsar
kamsar / sample.yml
Created June 2, 2015 02:56
YAML Serialization
ID 32A37307-0A19-4995-949C-17D843D799D8
PID 1168BC6E-35CB-41DD-9256-B828550E9E50
TID FE8D0E16-455D-441E-A525-58B2128F6EFA
PATH /sitecore/content/test
---
DatabaseName: master
SharedFields:
- Id: a4f985d9-98b3-4b52-aaaf-4344f6e747c6
NameHint: __Workflow
Value: '{7121FA3D-B469-4412-A170-53A5D94A80E4}'
@kamsar
kamsar / MultiRootTreeList.cs
Created May 5, 2015 23:43
Multi-Root TreeList
using System;
using System.Linq;
using Sitecore.Diagnostics;
using Sitecore.Globalization;
using Sitecore.Shell.Applications.ContentEditor;
using Sitecore.Text;
using Sitecore.Web;
using Sitecore.Web.UI.HtmlControls;
using Sitecore.Web.UI.WebControls;
@kamsar
kamsar / ee.html
Created February 17, 2015 15:37
Open field editor in Sitecore Experience Editor
<a href="javascript:Sitecore.PageModes.PageEditor.postRequest('webedit:fieldeditor(command={11111111-1111-1111-1111-111111111111},fields=Field Name 1|Field Name 2,id={item-id-to-edit-with-braces})')">Edit fields</a>
#
# MongoDB (as a windows service)
#
$mongoDbPath = "$env:SystemDrive\MongoDB"
$mongoDbConfigPath = "$mongoDbPath\mongod.cfg"
$url = "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-3.2.7.zip"
$zipFile = "$mongoDbPath\mongo.zip"
$unzippedFolderContent ="$mongoDbPath\mongodb-win32-x86_64-2008plus-3.2.7"
if ((Test-Path -path $mongoDbPath) -eq $false)
@kamsar
kamsar / SwitchMasterToWeb.config
Last active April 9, 2017 20:35
Sitecore 8 Patched SwitchMasterToWeb.config
<?xml version="1.0" encoding="utf-8" ?>
<!--
Purpose: This include file simplifies the setup of Sitecore CD instances by removing any references to the Master database from Sitecore configuration files.
This include file should be used only on CD servers.
Important: Include files are applied in alphabetical order. Therefore this include file cannot remove any references to the Master database
that are defined in include files that are applied later. In this situation, you must rename this include file so that it is applied after
any other include files that contain references to "master" database.
@kamsar
kamsar / PageEditor.js
Created January 14, 2015 14:25
Fix Ctrl-S in Sitecore 8 RTM Experience Editor
// Open the Website\sitecore\shell\Applications\Page Modes\PageEditor.js file
// Search for "e.keyCode == 83"
// Make the statement look like this:
//Ctrl+S
if (e.keyCode == 83 && e.ctrlKey) {
e.preventDefault();
this.onSaving();//fix for 428752
this.save();
return;
@kamsar
kamsar / GetFromSynthesis.cs
Created November 7, 2014 17:25
Synthesis Sitecore MVC prototype
using Synthesis.Mvc.Pipelines.GetRenderer;
using Sitecore.Mvc.Pipelines.Response.GetModel;
using Sitecore.Mvc.Presentation;
using Synthesis;
namespace Synthesis.Mvc.Pipelines.GetModel
{
public class GetFromSynthesis : GetModelProcessor
{
@kamsar
kamsar / DimensionStrippingGetImageFieldValue.cs
Created July 23, 2014 06:00
Sitecore 7,2-compatible rich text image dimension stripper
// Strips width and height attributes from Sitecore field rendered images without messing with the
// resizer's width and height attributes (as opposed to maxwidth/maxheight)
public class DimensionStrippingGetImageFieldValue : GetImageFieldValue
{
protected override Sitecore.Xml.Xsl.ImageRenderer CreateRenderer()
{
return new ImageRenderer();
}
private class ImageRenderer : Sitecore.Xml.Xsl.ImageRenderer
@kamsar
kamsar / AutoEncryptConnectionStrings.cs
Created July 16, 2014 00:55
Automatic web.config encryption example
using System.Configuration;
using System.Web;
using System.Web.Configuration;
using Foo.Web;
[assembly: WebActivatorEx.PostApplicationStartMethod(typeof(AutoEncryptConnectionStrings), "AutoEncrypt")]
namespace Foo.Web
{
public class AutoEncryptConnectionStrings
@kamsar
kamsar / zContentSearch.config
Created May 15, 2014 03:32
SubcontentField registration patch
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<indexConfigurations>
<defaultLuceneIndexConfiguration>
<fields hint="raw:AddComputedIndexField">
<!-- indexes subcontent contents into parent's _content field in the index (for better site search) -->
<field fieldName="_content" type="Foo.ContentSearch.ComputedFields.SubcontentField, Foo" />
</fields>
</defaultLuceneIndexConfiguration>