Skip to content

Instantly share code, notes, and snippets.

The following code is intended for use as an overloaded extension for the GetPropertyValue<T>(string alias, bool recurse) method when getting strongly typed values back.

This example uses Archetype where in Umbraco v7.1.8 calling such a property value recursively returns an ArchetypeModel with 0 fieldsets.

There could be other possible applications for allowing a developer to determine the logic when GetPropertyValue(string alias, bool recurse) is trying to get a value recursively but accepts it.

@leekelleher
leekelleher / umbraco.io.user.js
Last active March 19, 2018 15:10
Umbraco Cloud UserScript - to assist with common tasks
// ==UserScript==
// @name Umbraco Cloud - UI Fixes
// @namespace http://leekelleher.com/
// @version 0.6.1
// @description Hacking around on umbraco.io
// @author Lee Kelleher
// @match https://www.umbraco.io/project/*
// @match https://www.s1.umbraco.io/project/*
// @grant none
// ==/UserScript==
@leekelleher
leekelleher / 01-umbraco-xml-cache-json-namespaced.xml
Last active March 16, 2016 10:19
Umbraco: Converting and namespacing the JSON data to XML (for use with XSLT/XPath)
<root id="-1">
<HomePage id="1234" parentID="-1" level="1" creatorID="1" sortOrder="0" createDate="2014-12-16T00:00:00" updateDate="2014-12-16T00:00:00" nodeName="Home" urlName="home" path="-1,1156" isDoc="" nodeType="1111" creatorName="admin" writerName="admin" writerID="1" template="0" nodeTypeAlias="HomePage">
<archetypeLinks><![CDATA[{"fieldsets":[{"properties":[{"alias":"linkUrl","value":"http://www.example.com/"},{"alias":"linkLabel","value":"Website"}],"alias":"externalLink","disabled":false},{"properties":[{"alias":"linkUrl","value":"http://www.example2.com/"},{"alias":"linkLabel","value":"Webshop"}],"alias":"externalLink","disabled":false}]}]]></archetypeLinks>
<json:archetypeLinks xmlns:json="http://pimpmyxslt.com/json">
<fieldsets>
<properties>
<alias>linkUrl</alias>
<value>http://www.example.com/</value>
</properties>
<properties>
@leekelleher
leekelleher / our.umbraco.org.user.js
Last active February 9, 2018 11:32
Our Umbraco UserScript - declutter homepage for "power users"
// ==UserScript==
// @name Declutter Our Umbraco
// @namespace http://leekelleher.com/
// @version 0.2.9
// @description Declutters the Our Umbraco homepage, bringing focus to latest forum activity and projects
// @author Lee Kelleher
// @match https://our.umbraco.org/
// @grant none
// ==/UserScript==
@leekelleher
leekelleher / chocolatey.config
Created March 10, 2016 15:42
My Chocolatey package config - `choco install chocolatey.config`
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="7zip.install" />
<package id="notepadplusplus" />
<package id="googlechrome" />
<package id="skype" />
<package id="putty.install" />
<package id="kdiff3" />
<package id="gitextensions" />
<package id="windirstat" />
@leekelleher
leekelleher / PolymorphicCollectionMappingTests.cs
Created May 3, 2016 22:53
Ditto - unit-test to explore how mapping polymorphic collections might work
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace Our.Umbraco.Ditto.Tests
{
[TestFixture]
public class PolymorphicCollectionMappingTests
{
@leekelleher
leekelleher / SupersetPublishedContent.cs
Last active August 29, 2018 12:40
IPublishedContent superset - exploring an idea where a piece of content can become a superset of another piece of content (from elsewhere in the content-tree)
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
namespace Our.Umbraco.Web.Models
{
public class SupersetPublishedContent : IPublishedContent
@leekelleher
leekelleher / QueryStringAttribute.cs
Created October 18, 2016 11:05
A QueryString processor for Ditto
using System.Web;
using Umbraco.Core;
namespace Our.Umbraco.Ditto
{
public class QueryStringAttribute : DittoProcessorAttribute
{
public QueryStringAttribute(string key)
: this()
{
@leekelleher
leekelleher / MarkdownPropertyDescriptions.cs
Last active February 5, 2020 06:52
Umbraco - Converts a property's description using markdown
using Umbraco.Core;
using Umbraco.Web.Editors;
namespace Our.Umbraco
{
public class MyBootstrapper : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
EditorModelEventManager.SendingContentModel += (sender, e) =>
@leekelleher
leekelleher / html5-canvas-png-tintcolor.html
Created May 12, 2017 16:06
Playing around with HTML Canvas to tint the colour of a white logo (on transparent background) PNG
<html>
<head>
<title>canvas</title>
</head>
<body bgcolor="white">
<h1>canvas</h1>
<canvas id="logo"></canvas>
<script>
var can = document.getElementById("logo");