Skip to content

Instantly share code, notes, and snippets.

View hartviglarsen's full-sized avatar
⚽

Morten Hartvig hartviglarsen

⚽
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
if (bodyText.InvariantContains(product.Name))
{
if (relationService.AreRelated(doc, product, "product") == false)
{
relationService.Relate(doc, product, "product");
}
}
else
{
if (relationService.AreRelated(doc, product, "product") == true)
@hartviglarsen
hartviglarsen / web.config
Created February 11, 2019 09:33
Local SMTP delivery
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="C:\Temp\Mail\" />
</smtp>
</mailSettings>
</system.net>
</configuration>
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
TreeControllerBase.TreeNodesRendering += TreeControllerBase_TreeNodesRendering;
}
private void TreeControllerBase_TreeNodesRendering(TreeControllerBase sender, TreeNodesRenderingEventArgs e)
{
if (sender.TreeAlias == "content")
{
var shared = e.Nodes?.Where(x => x.Name == "Shared").FirstOrDefault();
ISearchResults Search(string term, string limit)
{
var terms = new List<IExamineValue>();
if (term.Contains(" "))
{
foreach (var t in term.Trim().Split(' '))
{
terms.Add(t.MultipleCharacterWildcard());
terms.Add(t.SingleCharacterWildcard());
<add name="TownIndexer"
type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine"
indexSet="ukTownsIndexSet"
dataService="SearchCourse.Core.Indexer.DbIndexer, SearchCourse.Core"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
indexTypes="ukTown"
runAsync="true" />
<IndexSet SetName="ukTownsIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/uktowns/">
<IndexUserFields>
<add Name="name" EnableSorting="true"/>
<add Name="county" EnableSorting="true"/>
<add Name="country"/>
<add Name="grid_reference" />
<add Name="latitude" />
<add Name="longitude"/>
<add Name="postcode_sector"/>
</IndexUserFields>
public class TextPageController : RenderMvcController
{
private readonly IExamineManager _examineManager;
public TextPageController(IExamineManager examineManager)
{
_examineManager = examineManager;
}
public ActionResult TextPage(ContentModel model)
using System.Web.Mvc;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
namespace UmbracoDI
{
public class MyComposer : IComposer
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Events;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
namespace MvcCourse.Core
{