Skip to content

Instantly share code, notes, and snippets.

@JamesEggers1
JamesEggers1 / gist:07f931382fb66f377b0870d1a92ecb7b
Last active April 5, 2019 00:40
Sitecore 8.x Custom Facet Repository
using System;
using Sitecore.Analytics;
using Sitecore.Analytics.Model.Entities;
namespace MyNamespace.Repositories
{
public interface IPaymentFacetRepository
{
void SetFacentInformation(string userIdentifier, decimal lastPaymentAmount, DateTime lastPaymentDate);
}
@JamesEggers1
JamesEggers1 / gist:8a42c925b2909869cd71408d49057d19
Last active April 5, 2019 00:36
Sitecore 8.x Custom Facet Patch File
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<model>
<elements>
<element interface="MyNamespace.Facet.IContactPortalInfo, MyNamespace" implementation="MyNamespace.Facet.ContactPortalInfo, MyNamespace"/>
</elements>
<entities>
<contact>
<facets>
@JamesEggers1
JamesEggers1 / gist:6bb33962d37843c182fb9f8b28e004b9
Created April 4, 2019 23:53
Sitecore 8.x Custom Facet Interface and Implementation
using Sitecore.Analytics.Model.Framework;
using System;
namespace MyNamespace.Facets
{
public interface ICustomerPaymentFacet : IFacet
{
decimal LastPaymentAmount { get; set; }
DateTime LastPaymentDate { get; set; }
}
@JamesEggers1
JamesEggers1 / gist:c6d37c2dd9d371df43787ddb54f6796e
Created March 19, 2019 01:05
Sitecore Patch File To Change Login Screen Background
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Login.BackgroundImageUrl">
<patch:delete />
</setting>
<setting name="Login.BackgroundImageUrl" value="/path/to/images/new_wallpaper_filename.jpg" />
</settings>
</sitecore>
</configuration>
@JamesEggers1
JamesEggers1 / gist:ca214291fb3a7d2f048dd4205c321c25
Created March 19, 2019 01:04
Sitecore Login Background Styling
background: url(/sitecore/login/drop_wallpaper.jpg) no-repeat center center fixed;
background-size: cover;
@JamesEggers1
JamesEggers1 / Orientation.js
Created February 24, 2012 22:42
My Orientation Change polyfill module
var OrientationManager = (function () {
"use strict";
var supportsOrientationChange = window.hasOwnProperty("onorientationchange")
, orientationEvent = supportsOrientationChange ? "orientationchange" : "resize"
, currentOrientation = window.orientation || 0
, currentWidth = window.outerWidth;
function orientationChanged(callBack) {
var newWidth = window.outerWidth
@JamesEggers1
JamesEggers1 / gist:5245252
Created March 26, 2013 13:12
An example of what I'd like to be able to do in Jade.
!!! 5
head
body
//- Currently this is the norm and works find
include path/to/partial
//- This is what I want to be able to do - provide the base directory from the route/rendering data.
include #{dir_from_route}/to/partial
@JamesEggers1
JamesEggers1 / timestamp.js
Created June 26, 2012 19:50
A simple timestamp module
module.exports = function(){
var date = new Date()
, year = date.getFullYear()
, month = date.getMonth() + 1
, day = date.getDate()
, hours = date.getHours()
, minutes = date.getMinutes()
, seconds = date.getSeconds();
if (month < 10) { month = "0" + month; }
@JamesEggers1
JamesEggers1 / slide.js
Created February 23, 2012 22:10
A simple, recursive animation algorithm for scrolling an element over a certain duration.
function slide(element, value, duration, total) {
if (!total) { total = 0;}
if (total >= duration) {return;}
var startLocation = element.scrollLeft;
var totalDistance = Math.abs(value - startLocation);
var step = 25;
var direction = (startLocation < value) ? "left" : "right";
var iteration = duration / step;
var iterationDistance = totalDistance / iteration;
public class ObjectUnderTest
{
private string _prefix;
public ObjectUnderTest(string prefix)
{
_prefix = prefix;
}
public dto MapObject(obj input)