Skip to content

Instantly share code, notes, and snippets.

View smdooley's full-sized avatar

Sean Dooley smdooley

View GitHub Profile
@smdooley
smdooley / ReadMe.md
Created April 10, 2025 13:42
Visual Studio Code MCP Server setup
  1. Obtain an MCP Server from https://mcp.so/ e.g. https://mcp.so/server/supabase-mcp/supabase-community?tab=content
  2. In VS Code, open the command palette and select MCP: Add Server...
  3. Select NPM Package.
  4. Paste the NPM package
  5. Select Allow
  6. Enter the connection string
  7. Select User Settings (e.g. available to all projects) or Workspace Settings (e.g. available to the current project)
  8. Run the MCP Server from settings.json.
  9. Test the setup by asking Copilot #query what is the schema of my database?
@smdooley
smdooley / AuthorFilter.cs
Created May 25, 2023 09:33
Extending Umbraco Content Delivery API
using Umbraco.Cms.Core.DeliveryApi;
namespace UmbracoPlayground.UI.Application.Filters
{
public class AuthorFilter : IFilterHandler
{
private const string FilterType = "author:";
public FilterOption BuildFilterOption(string filter)
{
using System;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace Project.Core.Extensions
{
public static class EnumExtensions
{
public static string GetEnumDescription(this Enum value)
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web;
public static class EnumerableExtensions {
public static bool HasAny<T> (this IEnumerable<T> items) => items != null && items.Any();
public static bool IsNullOrEmpty<T>(this IEnumerable<T> items)
@smdooley
smdooley / XPathQueryExamples.md
Created January 19, 2023 10:34
Various XPath query examples for Umbraco Multinode Treepicker

Umbraco Multinode Treepicker

Available placeholders

  • $current Current page or closest found ancestor
  • $parent Parent page or closest found ancestor
  • $root Root of the content tree
  • $site Ancestor node at level 1

Examples

@smdooley
smdooley / UrlHelper.cs
Created January 11, 2023 10:56
UrlHelper class to validate URL
using System.Text.RegularExpressions;
using Umbraco.Extensions;
namespace Concept.Core.Helpers
{
public static class UrlHelper
{
private const string URL_SCHEME_PATTERN = @"^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$";
private const string URL_RELATIVE_PATTERN = @"^\/([\w-]+.)+[\w-]+(\/[\w- ])?\S$";
@smdooley
smdooley / BlockListNotification.cs
Last active January 11, 2023 12:53
Using Umbraco notifications with a Block List Editor
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models.Blocks;
using Umbraco.Cms.Core.Notifications;
namespace Concept.Core.NotificationHandlers
{
public class ContentPublishing : INotificationHandler<ContentPublishingNotification>
{
public void Handle(ContentPublishingNotification notification)
{
@smdooley
smdooley / UmbracoHtmlHelperExtensions.cs
Created January 11, 2023 10:52
Umbraco related HTML helper extension methods
using System.Text;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Umbraco.Cms.Core.Models;
using Umbraco.Extensions;
namespace Concept.Core.Extensions
{
public static class HtmlHelperExtensions
@smdooley
smdooley / TableMarkupHelper.cs
Last active January 11, 2023 10:55
Helper class to dynamically update table HTML markup
using HtmlAgilityPack;
namespace Concept.Core.Helpers
{
public static class TableMarkupHelper
{
public static ApplyHtmlStyleGuidelines(string text)
{
HtmlDocument htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(text);
// https://github.com/photonstorm/phaser3-examples/blob/master/public/src/game%20objects/graphics/health%20bars%20demo.js
import Phaser from "phaser";
export default class HealthBar extends Phaser.GameObjects.Container {
constructor(scene, x, y) {
super(scene, x, y);
this.bar = new Phaser.GameObjects.Graphics(scene);