Skip to content

Instantly share code, notes, and snippets.

@komainu85
komainu85 / ChartController.cs
Created June 24, 2015 14:58
Sitecore Services API Controller
namespace MikeRobbins.Controllers
{
[ServicesController]
public class ChartController : ServicesApiController
{
private ISearcher _searcher;
private IMapper _mapper;
public ChartController(ISearcher iSearcher, IMapper iMapper)
{
@komainu85
komainu85 / Sitecore SPEAK open tab in parent Content Editor
Created June 23, 2015 13:19
Sitecore SPEAK open tab in parent Content Editor
parent.scForm.postRequest(\'\', \'\', \'\', \'contenteditor:launchtab(url={{DatasourceId}}, la=en, datasource=sitecore)\')
@komainu85
komainu85 / gist:2b5bf03018a85b5ab824
Created June 2, 2015 12:10
Dev sitecore 8 config from Alex Shyba
<!--
IMPORTANT: This configuration file is not intended for any production Sitecore installation.
Purpose: This include file contains some experimental optimizations that can speed up start-up.
Please, review each of the patched elements below and consider if some of the optimizations should be commented out due to the specifics of your solution.
Enabling this file without taking into account the specifics of your solution can have unexpected consequences.
To enable this include file, rename it to have a ".config" extension.
public class DmsManager : IDmsManager
{
readonly Guid _searchPageEventGuid = Sitecore.Context.Database.GetItem("{0C179613-2073-41AB-992E-027D03D523BF}").ID.Guid;
readonly Guid _downloadPageEventGuid = Sitecore.Context.Database.GetItem("{FA72E131-3CFD-481C-8E15-04496E9586DC}").ID.Guid;
private ICurrentPageContext CurrentPage()
{
return Tracker.Current.Session.Interaction.CurrentPage;
}
@komainu85
komainu85 / Entity Service Validation Model.cs
Last active August 29, 2015 14:21
Entity Service Validation Model
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace MikeRobbins.EntityServiceDemo.Models
{
public class NewsArticle : Sitecore.Services.Core.Model.EntityIdentity
{
@komainu85
komainu85 / Entity Service Validation JavaScript
Created May 25, 2015 16:57
Entity Service Validation JavaScript
EntityService.utils.validator.add("notPastDate", function (value, params) {
var result = false;
var currentDate = new Date();
result = value >= currentDate;
return result;
});
@komainu85
komainu85 / Entity Service Validation Meta Data
Created May 25, 2015 16:55
Entity Service Validation Meta Data
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using MikeRobbins.EntityServiceDemo.Attributes;
using Sitecore.Services.Core.MetaData;
namespace MikeRobbins.EntityServiceDemo.MetaData
{
@komainu85
komainu85 / Entity Service Validation Attribute
Created May 25, 2015 16:51
Entity Service Validation Attribute
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace MikeRobbins.EntityServiceDemo.Attributes
{
public class NotPastDateAttribute : ValidationAttribute
{
@komainu85
komainu85 / Entity Service Controller DI
Last active August 29, 2015 14:21
Entity Service Controller DI
[ServicesController]
public class EntityController : EntityService<Entity>
{
public EntityController(Sitecore.Services.Core.IRepository<Entity> repository)
{
}
}
@komainu85
komainu85 / IoC Registry
Created May 21, 2015 19:51
IoC Registry
public class IoCRegistry : Registry
{
public IoCRegistry()
{
For(typeof(IRepository<Entity>)).Use(typeof(MikeRobbins.Repositories.EntityRespository));
}
}