Skip to content

Instantly share code, notes, and snippets.

View fquintanilla's full-sized avatar

Francisco Quintanilla fquintanilla

View GitHub Profile
@fquintanilla
fquintanilla / DependencyResolverInitialization.cs
Last active July 12, 2019 22:57
Episerver - Integration with Webapi dependency resolver
[InitializableModule]
public class DependencyResolverInitialization : IConfigurableModule
{
public void ConfigureContainer(ServiceConfigurationContext context)
{
//Implementations for custom interfaces can be registered here.
context.ConfigurationComplete += (o, e) =>
{
//Register custom implementations that should be used in favour of the default implementations
$criteria = @(
@{Filter = "Equals"; Field = "_group"; Value = "cdc03752f74a4558862c06b0e52ceac0"},
@{Filter = "Equals"; Field = "_language"; Value = "en"}
)
$props = @{
Index = "sitecore_web_index"
Criteria = $criteria
}
Find-Item @props -First 1 | Select-Object -Expand "Fields"
@fquintanilla
fquintanilla / MvcOutputCache.cs
Created February 22, 2019 15:24
MvcOutputCache
namespace MvcOutputCache
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web;
using System.Web.Caching;
public class CustomAuthorizationProvider : OAuthAuthorizationServerProvider
{
public override async Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
{
context.Validated();
}
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
@fquintanilla
fquintanilla / FieldNotSelected.ps1
Created August 3, 2018 21:12
Powershell report
<#
.SYNOPSIS
Lists all bio detail records that do not have a location selected
.NOTES
Francisco Quintanilla
#>
filter Where-NoLocationSelected {
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
@fquintanilla
fquintanilla / Fingerprint.cs
Last active August 9, 2018 18:43
Fingerprinting
public static class CustomHtmlHelper
{
public static HtmlString Fingerprint(this HtmlHelper helper, string rootRelativePath)
{
return new HtmlString(Fingerprint(rootRelativePath, string.Empty));
}
private static string Fingerprint(string rootRelativePath, string extension)
{
if (HttpRuntime.Cache[rootRelativePath] != null)
@fquintanilla
fquintanilla / UpdateField.ps1
Created July 20, 2018 17:18
Update a field with the value of another field
cd 'master:/sitecore/content/Shared Data/Events/'
Get-ChildItem -Recurse . | Where-Object { $_.TemplateName -match "Event Detail Page" -and $_.Fields["Display Address"] -ne $null } | ForEach-Object {
if(($_.Fields["Display Address"].Value).length -eq 0 -and ($_.Fields["Map Address"].Value).length -gt 0) {
$_.Editing.BeginEdit()
$_.Fields["Display Address"].Value = $_.Fields["Map Address"].Value;
$_.Editing.EndEdit() | Out-Null
Write-Host $_.Name
}
}
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<indexing.resolveFieldBoost>
<processor type="Sitecore.ContentSearch.Pipelines.ResolveBoost.ResolveFieldBoost.SystemFieldFilter, Sitecore.ContentSearch">
<patch:delete />
</processor>
<processor type="Sitecore.ContentSearch.Pipelines.ResolveBoost.ResolveFieldBoost.FieldDefinitionItemResolver, Sitecore.ContentSearch">
<patch:delete />
@fquintanilla
fquintanilla / Foundation.Search.config
Created May 28, 2018 20:58
Sitecore PDF indexing errors
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<indexConfigurations>
<defaultSolrIndexConfiguration>
<mediaIndexing>
<mimeTypes>
<includes>
@fquintanilla
fquintanilla / web.config
Created May 24, 2018 15:49
Solve Memory Leak Issue
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
<add type="Sitecore.DependencyInjection.SitecorePerRequestScopeModule, Sitecore.Kernel" name="SitecorePerRequestScopeModule" />
...
</system.webServer>