Skip to content

Instantly share code, notes, and snippets.

View mattbrailsford's full-sized avatar

Matt Brailsford mattbrailsford

View GitHub Profile
  1. Add .gitignore to static assets project with wwwroot/
  2. Update vite configuration with outDir "../wwwroot/"
  3. Remove Build\Microsoft.AspNetCore.ClientAssets.targets
  4. Create Build\ClientAssets.targets with the following contents
<Project>
  
  <PropertyGroup>
 Client\
@mattbrailsford
mattbrailsford / todos.cs
Created August 3, 2022 12:49
REST Konstrukt Repository
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using Konstrukt.Persistence;
using Konstrukt.Web.Site.Models;
using Umbraco.Cms.Core.Models;
public class UmbracoSurfaceControllerDependencies
{
#if NET
public IUmbracoContextAccessor UmbracoContextAccessor { get; set; }
public IUmbracoDatabaseFactory DatabaseFactory { get; set; }
public ServiceContext Services { get; set; }
public AppCaches AppCaches { get; set; }
public IProfilingLogger ProfilingLogger { get; set; }
public IPublishedUrlProvider PublishedUrlProvider { get; set; }
@mattbrailsford
mattbrailsford / Controller.cs
Created February 11, 2022 09:52
Published Content Wrapper for v8 + v9
public class MyController : Controller
{
private readonly PublishedContentWrapperFactory _publishedContentWrapper;
public MyController(PublishedContentWrapperFactory publishedContentWrapper)
=> _publishedContentWrapper = publishedContentWrapper;
[HttpGet]
public IActionResult DoSomething()
{
@mattbrailsford
mattbrailsford / GitVersion.yml
Last active August 16, 2021 13:40
GitVersion config that supports explicit alpha, beta and rc releases
branches:
master:
regex: ^ma[ster|in]
release-alpha:
regex: ^releases?[/-](.*)-alpha$
mode: ContinuousDeployment
tag: alpha
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
@mattbrailsford
mattbrailsford / XPathLookupDataSource.cs
Created March 4, 2021 09:13
nuPickers data source to lookup values from a Nest Content property
using nuPickers.Shared.DotNetDataSource;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace Outfield.Digital.DataSources
{
@mattbrailsford
mattbrailsford / ContentExtensions.cs
Last active March 23, 2021 16:57
Converts an IContent element to IPublishedContent in Umbraco v8
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Strings;
using Umbraco.Web.Composing;
public class CourceService
{
internal CourceService(siteId, apiKey)
{
// TODO: Handle params...
}
}
// The CourseServiceFactory should be registered with the DI container
// and should be registered as a singleton
public class MyEntityNotificationBase : NotificationEventBase
{
public MyEntity Entity { get; }
public MyEntityNotificationBase(MyEntity entity)
{
Entity = entity;
}
}
(function () {
'use strict';
var routeMap = [
{
pattern: /^views\/vendrproductreviews\/(.*)-(.*).html(.*)$/gi,
map: '/app_plugins/vendrproductreviews/views/$1/$2.html$3'
},
{