Skip to content

Instantly share code, notes, and snippets.

View marcduiker's full-sized avatar
/-/

Marc Duiker marcduiker

/-/
View GitHub Profile
using System;
using Moq;
using NUnit.Framework;
using Sitecore.Data;
using SitecorePlayground.Common.Interfaces.Adapters;
using SitecorePlayground.Common.Interfaces.Providers;
@marcduiker
marcduiker / extensionmethod.snippet.xml
Created October 5, 2015 13:33
Visual Studio code snippet to create an extension method.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>Extension Method</Title>
<Author>Marc Duiker</Author>
<Description>Snippet to create an extension method.
<#
This function uploads & installs the specified Sitecore update package to the given $SiteUrl.
It uses cURL (http://curl.haxx.se/) to post a request to a Sitecore website which has Sitecore Ship installed.
Example usage:
.\deploy-sitecorepackage.ps1 mysite.dev "C:\Project\Build\Artifacts\1-mysite-templates.update" 60 300
#>
Param(
[Parameter(Position=0, Mandatory=$true)]
<#
This script returns the full path of the curl.exe.
#>
$curlExe = 'curl.exe'
$curlPath = Resolve-Path "$PSScriptRoot\..\tools\curl-7.33.0-win64-nossl\$curlExe" # This is the path on the local dev machine.
if (-not (Test-Path $curlPath))
{
# Fall-back to use curl.exe located in the same location as the script.
if (Test-Path "$PSScriptRoot\$curlExe")
@marcduiker
marcduiker / extensionmethod.snippet
Last active December 19, 2015 08:59
Visual Studio snippet for an extension method.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>Extension Method</Title>
<Author>Marc Duiker</Author>
<Description>Snippet to create an extension method.
@marcduiker
marcduiker / Sitecore.Buckets.config.xml
Created April 28, 2016 19:56
Partial configuration that takes care of removing empty bucket folders in Sitecore.
<!-- EMPTY BUCKET CLEANING JOB
This job runs at the set interval time and removes item bucket folders that no longer contain any items.
This could be cause by deleting an item from a bucket, which has no other items in it.
-->
<scheduling>
<frequency>00:00:05</frequency>
<!-- Adjust the interval and frequency as needed to speed things up on a local dev environment. -->
<agent type="Sitecore.Buckets.Tasks.RemoveEmptyBucketFolders" method="Run" interval="00:00:10">
<DatabaseName>master</DatabaseName>
</agent>
@marcduiker
marcduiker / UnitTestWithBulkyArrangeSection.cs
Last active June 2, 2016 21:37
Unit test with bulky assert section. The unit test uses Autofixture, FakeItEasy and FluentAssertions.
[Fact]
public void GetHighestRatedMovies_RepositoryContainsMoviesWithRatings_ReturnsMoviesOrderedByDescendingRating()
{
// Arrange
var fixture = new Fixture();
var movieCollection = fixture.CreateMany<Movie>(20).ToList();
var fakeMovieRepository = A.Fake<IMovieRepository>();
A.CallTo(() => fakeMovieRepository.GetAll()).Returns(movieCollection);
IMovieService movieService = new MovieService(fakeMovieRepository, null, null);
MovieServiceRequest request = new MovieServiceRequest { NumberOfMoviesToReturn = 5 };
@marcduiker
marcduiker / local_dev_box.txt
Created July 20, 2016 19:46
Boxstarter script for installing dev tools on my local dev machine.
cinst cURL
cinst fiddler4
cinst git
cinst ilspy
cinst luke.portable
cinst mssqlserver2014express
cinst mssqlservermanagementstudio2014express
cinst nodejs.install
cinst notepadplusplus
cinst nuget.commandline
@marcduiker
marcduiker / NuGet_profile.ps1
Created December 28, 2016 00:13
NuGet PowerShell profile which loads the add-helixmodule.ps1 script
<#
Loads the add-helixmodule.ps1 script to enable the creation of Feature and Foundation project in Sitecore Helix solutions.
You need to change this path to the location where the script is located on your local machine.
Once the script is loaded the Add-Feature and Add-Foundation methods are available in the Package Manager Console in Visual Studio.
#>
. "C:\dev\git\HabitatFork\scripts\add-helixmodule.ps1"
@marcduiker
marcduiker / add-helix-module-configuration.json
Created December 28, 2016 00:29
Configuration file to be used with the add-helixmodule.ps1 script in order to create a new Sitecore module easily.
{
"__comment": "This configuration file is used by the add-helix-module.ps1 script which creates modules for Sitecore Helix solutions.",
"config": {
"__comment__moduleTemplatePath": "Update the moduleTemplatePath property to point to your module-template location.",
"moduleTemplatePath": "C:\\dev\\git\\HabitatFork\\module-template",
"__comment__featureNamespacePrefix": "Replace the value for featureNamespacePrefix with a suitable namespace prefix. The Feature.<ModuleName> will be appended by the script.",
"featureNamespacePrefix": "CompanyNamespace.ClientNamespace",
"__comment__foundationNamespacePrefix": "Replace the value for featureNamespacePrefix with a suitable namespace prefix. The Foundation.<ModuleName> will be appended by the script.",
"foundationNamespacePrefix": "CompanyNamespace",
"__comment__sourceFolderName": "The sourcefolder should contain the relative path (from the sln file folder) where the Feature, Foundation and Project folders are located. The Sitecore Habitat default is