Skip to content

Instantly share code, notes, and snippets.

@Azadehkhojandi
Azadehkhojandi / gulpfile.js
Last active May 16, 2018 06:18
Gulp webserver boilerplate
"use strict";
var gulp = require('gulp');
var connect = require('gulp-connect'); //Runs a local dev server
var open = require('gulp-open'); //Open a URL in a web browser
var config = {
port: 9005,
url: 'http://localhost',
@Azadehkhojandi
Azadehkhojandi / markup.html
Last active October 19, 2016 23:45
How to have responsive hamburger menu and brand logo with boot strap v4 alpha
<nav class="navbar navbar-light header-background p-x-0" id="nav2">
<button class="navbar-toggler hidden-lg-up pull-xs-right" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar2" aria-controls="exCollapsingNavbar2" aria-expanded="false" aria-label="Toggle navigation">
&#9776;
</button>
<a class="navbar-brand hidden-md-down p-l-1" href="#">
<img class="img-fluid" alt="" src="/images/Logo.png">
</a>
<a class="navbar-brand hidden-lg-up p-l-1" href="#">
<img width="100" alt="" src="/images/Logo.png">
</a>
function Dispatcher() {
this._lastID = 0;
this._callbacks = {};
}
Dispatcher.prototype.register = function(callback) {
var id = 'CID_' + this._lastID++;
this._callbacks[id] = callback;
return id;
};
var container = new UnityContainer();
container.RegisterTypes(AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()));
container.RegisterTypes(AllClasses.FromLoadedAssemblies());
container.RegisterInstance(typeof(UmbracoHelper), new UmbracoHelper(UmbracoContext.Current));
container.RegisterInstance(typeof(UmbracoContext), UmbracoContext.Current);
container.RegisterInstance(typeof(Merchello.Core.IMerchelloContext), MerchelloContext.Current);
container.RegisterInstance(typeof(ApplicationContext), ApplicationContext.Current);
container.RegisterInstance(typeof(ServiceContext), ApplicationContext.Current.Services);
@Azadehkhojandi
Azadehkhojandi / FixClonedItems.aspx
Created April 12, 2016 03:57
Migrating cloned items to sitcore 8.1 and above
<%@ page language="C#" async="true" autoeventwireup="true" codebehind="FixClonedItems.aspx.cs" inherits="Web.sitecore.admin.Migration.FixClonedItems" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Migartion Fix Cloned Items</title>
<style type="text/css">
body {
font-family: normal 11pt "Times New Roman", Serif;
}
@Azadehkhojandi
Azadehkhojandi / ByLocalSearchNoResult.cs
Created April 6, 2016 06:14
Add Sitecore page event report to Experience Analytics - adding a chart to show top internal search keywords which returns no result (/sitecore/system/Settings/Analytics/Page Events/No search hits found)
public class ByLocalSearchNoResult : PageEventDimensionBase
{
private readonly Guid noSearchHitsFoundId = AnalyticsIds.NoSearchHitsFound.Guid;
public ByLocalSearchNoResult(Guid dimensionId) : base(dimensionId)
{
}
public override bool Filter(PageEventData pageEventData)
{
Assert.IsNotNull((object)pageEventData, "pageEvent");
//references
//http://www.sitecore.net/Learn/Blogs/Technical-Blogs/John-West-Sitecore-Blog/Posts/2013/05/Sitecore-7-Enable-Default-Computed-Index-Fields.aspx
//http://kamsar.net/index.php/2014/05/indexing-subcontent/
//http://www.techphoria414.com/Blog/2013/November/Sitecore-7-Computed-Fields-All-Templates-and-Datasource-Content
public class SubcontentField : IComputedIndexField
{
public string FieldName { get; set; }
public string ReturnType { get; set; }
@Azadehkhojandi
Azadehkhojandi / HtmlCrawledField.cs
Created February 5, 2016 05:19
HtmlCrawledField computed field - extending sitecore indexing
//references https://github.com/hermanussen/sitecore-html-crawler
public class HtmlCrawledField : IComputedIndexField
{
public string FieldName { get; set; }
public string ReturnType { get; set; }
public object ComputeFieldValue(IIndexable indexable)
{
Assert.ArgumentNotNull(indexable, "indexable");
@Azadehkhojandi
Azadehkhojandi / InsertFormWizard.cs
Last active January 22, 2016 04:46 — forked from jammykam/InsertFormWizard.cs
Updated form selector to allow selection of existing forms
using System;
using System.Text;
using Sitecore;
using Sitecore.Data.Items;
using Sitecore.Globalization;
using Sitecore.Web.UI.HtmlControls;
using Sitecore.Web.UI.Sheer;
//https://jammykam.wordpress.com/2015/10/05/webforms-for-marketers-allow-selection-of-existing-forms/
namespace LendLease.Extension.Sc.WFFM
@Azadehkhojandi
Azadehkhojandi / .bowerrc
Last active January 8, 2016 03:14
Proxy settings
{
"proxy": "http://IP:port/",
"https-proxy": "http://IP:port/",
"strict-ssl": false
}