Skip to content

Instantly share code, notes, and snippets.

@geoffreysmith
geoffreysmith / gist:5544474
Last active December 17, 2015 03:38
Automated Sitecore installation in Dropkick
public class TheDeployment : Deployment<TheDeployment, DeploymentSettings>
{
public TheDeployment()
{
Define(settings => DeploymentStepsFor(SitecoreInstallation, s =>
{
s.UnzipArchive(settings.SitecoreArchivePath).To(settings.SitecoreExtractPath).DeleteDestinationBeforeDeploying();
s.CopyDirectory(settings.SitecoreExtractPath + @"Sitecore 6.6.0 rev. 130404\Website\").To(settings.WebsitePath).ClearDestinationBeforeDeploying();
public static class GlassMapperScCustom
{
public static void CastleConfig(IWindsorContainer container)
{
var config = new Config();
container.Install(new SitecoreInstaller(config));
container.Register(
Component.For<ISitecoreContext>().ImplementedBy<SitecoreContext>().LifestyleTransient(),
public class NavigationItem : SitecoreItem
{
}
[SitecoreType]
public class NavigationFolder : SitecoreItem
{
[SitecoreField("Main Menu")]
public virtual IEnumerable<NavigationItem> MainMenu { get; set; }
}
@geoffreysmith
geoffreysmith / gist:5753569
Created June 11, 2013 00:08
sample sitecore lucene index
<configuration xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<databases>
<database id="web" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
<Engines.HistoryEngine.Storage>
<obj type="Sitecore.Data.$(database).$(database)HistoryStorage, Sitecore.Kernel">
<param connectionStringName="$(id)" />
<EntryLifeTime>30.00:00:00</EntryLifeTime>
</obj>
</Engines.HistoryEngine.Storage>
public class StubItem : Item
{
public StubItem([NotNull] ID itemID, [NotNull] ItemData data, [NotNull] Database database)
: base(itemID, data, database)
{
}
private Language originalLanguage;
public Language OriginalLanguage
protected void Application_Error(object sender, EventArgs e)
{
var exception = Server.GetLastError();
Server.ClearError();
var routeData = new RouteData();
routeData.Values.Add("controller", "Error");
routeData.Values.Add("action", "Index");
Sitecore.Diagnostics.Log.Error("Application_Error invoked", exception, this);
@geoffreysmith
geoffreysmith / gist:9770887
Created March 25, 2014 20:42
sitecore facial recognition
public class MediaRequestOverride : MediaProvider
{
public override Media GetMedia(MediaUri mediaUri)
{
var mediaData = GetMediaData(mediaUri);
var media = GetMedia(mediaData);
return GetMediaFace(media);
}
@geoffreysmith
geoffreysmith / gist:6859d872420216821cff
Created February 12, 2015 11:08
Vagrant Sitecore8 dependencies
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.synced_folder ".", "/vagrant"
# Basic setup
Update-ExecutionPolicy Unrestricted
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
Disable-InternetExplorerESC
Disable-UAC
Set-TaskbarSmall
if (Test-PendingReboot) { Invoke-Reboot }
var superGet = self.get;
self.get = function (req, userCriteria, optionsArg, callback) {
var options = {};
var filterCriteria = {};
// "Why copy the object like this?" If we don't, we're modifying the
// object that was passed to us, which could lead to side effects
_.merge(options, optionsArg || {});
_.merge(filterCriteria, userCriteria || {});
// need a sort helper key on these fields to normalize the first and last names
// and handle upper/lower case letters. Adding this helper key normalizes the data.