Skip to content

Instantly share code, notes, and snippets.

@Matthew-Wise
Matthew-Wise / Program.cs
Created July 19, 2022 14:10
Umbraco 10 Application insights with Serilog sink
using Microsoft.ApplicationInsights.Extensibility;
using Serilog;
public class Program
{
public static void Main(string[] args)
=> CreateHostBuilder(args)
.Build()
.Run();
@Matthew-Wise
Matthew-Wise / BlockPreviewApiController.cs
Last active July 2, 2022 19:50
Block Previews - using ViewComponents
/*
*
* This uses https://github.com/dawoe/24-days-block-list-article/blob/develop/24Days.Core/Controllers/BlockPreviewApiController.cs
* as a base to follow all I did was change it from Partial views to ViewComponents. Yet to check if I can register the ViewComponentHelper instead of the cast.
* You will also need the App_Plugins from Dave's repo.
*/
using System;
using System.Globalization;
using System.IO;
using System.Linq;
@Matthew-Wise
Matthew-Wise / HomePageController.cs
Last active November 8, 2021 17:38
Umbraco v9 RenderMvcController replacement options
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Web.Common.Controllers;
using Umbraco.Cms.Web.Common.PublishedModels;
@Matthew-Wise
Matthew-Wise / umbracoforms.js
Created September 12, 2018 08:55
Add min date to Umbraco forms validation
(function ($) {
if ($.validator != undefined) {
$.validator.setDefaults({
ignore: ":hidden"
});
$.validator.unobtrusive.adapters.addBool("requiredcb", "required");
@Matthew-Wise
Matthew-Wise / ContentEvents.cs
Created July 6, 2018 13:46
Umbraco Multinode picker2 UDI's to GUID for examine
public class ContentPublishEvents : IApplicationEventHandler
{
public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}