Skip to content

Instantly share code, notes, and snippets.

View KevinJump's full-sized avatar
🚴

Kevin Jump KevinJump

🚴
View GitHub Profile
@KevinJump
KevinJump / numbraco.ps1
Last active March 12, 2024 00:45
Umbraco Setup and tear down scripts. (Gives you an approx 35 second Umbraco install)
# statup umbraco, and add some packages if you want
#
# e.g numbraco MyTestSite uSync Jumoo.TranslationManager vendr -NoStarter
#
# extras!!!
#
# open vscode in the folder as part of the build
# numbraco MyTestSite -code
#
# don't run the site
@KevinJump
KevinJump / MovePublisherTree.cs
Last active September 29, 2023 07:15
Move Publisher Section
using Microsoft.AspNetCore.Authorization;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Sections;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Trees;
using Umbraco.Cms.Web.BackOffice.Trees;
using Umbraco.Cms.Web.Common.Attributes;
@KevinJump
KevinJump / dailyrestore.cs
Created September 26, 2023 14:28
Umbraco Hangfire + uSync.Complete Create a restore point
using Hangfire;
using Hangfire.Server;
using Umbraco.Cms.Core.Composing;
using uSync.Expansions.Core.Restore.Services;
namespace uSync.Hangfire;
public class DailyRestoreComposer : IComposer
@KevinJump
KevinJump / WordCountController.cs
Created June 28, 2023 16:01
v8 - word count controller - does a hacky version of the full child page counting we do in v10/11/12
using System.Web.Http;
using Jumoo.TranslationManager.Core.Controllers;
using Newtonsoft.Json;
using Umbraco.Core.Services;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
@KevinJump
KevinJump / allproperties.cshtml
Created May 2, 2023 15:12
Display all the properties (and nested properties) for a content node in Umbraco 10/11.
@using Umbraco.Cms.Web.Common.PublishedModels;
@using Umbraco.Cms.Core.Models;
@using Umbraco.Cms.Core.Models.Blocks;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@{
Layout = null;
}
<html>
<head>
@KevinJump
KevinJump / UmbNavValueMapper.cs
Created March 17, 2023 15:46
UmbNav - ValueMapper for Umbraco 8.x - Translation manager v8.7.x
using System.Linq;
using Jumoo.TranslationManager.Core;
using Jumoo.TranslationManager.Core.Models;
using Jumoo.TranslationManager.Core.ValueMappers;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core;
@KevinJump
KevinJump / CopyNodeName.cs
Created October 20, 2022 12:01
Translation Manager v8 - Copy the node name between source and target languages when a translation is approaved
using Jumoo.TranslationManager.Core.Services;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Services;
namespace ExampleCode
{
//
// Example Code : CopyNodeName on Approval
@KevinJump
KevinJump / settingsDictionaryHandler.cs
Last active October 13, 2022 10:08
Note: this can now be done in usync with no custom code : https://github.com/KevinJump/uSync/releases/tag/8.4.4
/// ****************************************************
/// NOTE: As of uSync 8.8.4 this functionaliy exists in the core of the package
/// https://github.com/KevinJump/uSync/releases/tag/8.4.4
///
/// With ContentEdition Installed you can move the dictionayHandler with a Group="Settings" attribute in the config file.
/// ****************************************************
/// uSync Dictionary Handler
/// untested code - in theory this would make a dictionary handler that synced with the settings group in uSync not the content one.
@KevinJump
KevinJump / maintain.cs
Last active February 20, 2022 11:57
change umbraco content in middleware (example, may need some work!)
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.IO;
using System.Threading.Tasks;
using Umbraco.Cms.Core.Composing;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;