Skip to content

Instantly share code, notes, and snippets.

@leekelleher
leekelleher / ContentFinderByAsciiUrl.cs
Last active November 13, 2018 09:29
Umbraco - an IContentFinder that attempts to find the content by it's ASCII URL. This is useful for if an existing website has switched from non-ASCII URLs.
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Web;
using Umbraco.Web.Routing;
namespace Our.Umbraco.Web.Routing.ContentFinders
{
public class ContentFinderByAsciiUrl : IContentFinder
@leekelleher
leekelleher / ToListAttribute.cs
Created November 21, 2017 13:41
Ditto `ToList` processor
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Our.Umbraco.Ditto
{
public class ToListAttribute : DittoProcessorAttribute
{
public override object ProcessValue()
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Hosting;
using ImageProcessor.Web.Services;
namespace UmbrellaInc.Web.Services
{
@leekelleher
leekelleher / ProviderCollectionExtensions.cs
Last active March 13, 2019 17:48
Umbraco Forms - Extension methods to remove specific providers, e.g. removing a FieldType, such as Recaptcha
using System;
using System.Collections.Generic;
using System.Reflection;
using Umbraco.Forms.Core.Common;
namespace Our.Umbraco.Web.Extensions
{
public static class ProviderCollectionExtensions
{
public static void RemoveProvider<T>(this ProviderCollection<T> collection, params string[] providerIds)
@leekelleher
leekelleher / UmbracoFormsPickerValueConverter.cs
Created March 28, 2018 15:54
Umbraco Forms - Value Converter for the "Form Picker" property-editor, used to define the value type as a `Guid`
using System;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
namespace Our.Umbraco.Web.PropertyEditors
{
public class UmbracoFormsPickerValueConverter : PropertyValueConverterBase, IPropertyValueConverterMeta
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
@leekelleher
leekelleher / MyMacroContainerValueConverter.cs
Created April 5, 2018 16:47
Umbraco - Overrides the default MacroContainerValueConverter, to return the correct type, HtmlString
using System;
using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.ValueConverters;
using Umbraco.Web.PropertyEditors.ValueConverters;
namespace Our.Umbraco.Web.HotFixes
{
public class MyApplicationEventHandler : ApplicationEventHandler
@leekelleher
leekelleher / night-mode.css
Last active May 31, 2018 14:58
Prototype for an Umbraco "Night Mode" back-office UI theme
/*
Umbraco Night Mode - A BackOffice UI Theme
*/
body {
filter: invert(100%) hue-rotate(90deg) sepia(25%);
}
#umbracoMainPageBody {
background-color: #000;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Community.Contentment.DataEditors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web;
namespace MyWebsite.DataSources
{
public class PropertyDataDataSource : IDataListSource
{
@leekelleher
leekelleher / UmbracoImageCropDataListSource.cs
Created February 11, 2021 10:33
Umbraco Image Crop Picker using Contentment Data List
/* Copyright © 2021 Lee Kelleher.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Linq;
using Umbraco.Community.Contentment.DataEditors;
using Umbraco.Core;
@leekelleher
leekelleher / ContentmentDataSourcePreValueSource.cs
Last active April 19, 2021 13:21
Umbraco Forms - to populate the prevalues with a data-source from a Contentment data-editor
/* Copyright © 2021 Lee Kelleher.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Linq;
using Umbraco.Community.Contentment.DataEditors;