Skip to content

Instantly share code, notes, and snippets.

View nul800sebastiaan's full-sized avatar
🔥

Sebastiaan Janssen nul800sebastiaan

🔥
View GitHub Profile
@nul800sebastiaan
nul800sebastiaan / custom.element.ts
Last active October 15, 2025 07:37 — forked from Rockerby/custom.element.ts
A small example of how to create a custom element to be placed within the Workspace Action part for Umbraco 15+. This takes the existing element that is placed there and adds an icon in the button.
/*
* This file is a copy of the core version from https://github.com/umbraco/Umbraco-CMS/blob/6bca91a52fabfe96b7ede1837b908b33d78136ed/src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-action/default/workspace-action-default-kind.element.ts
* with the addition of a document icon in the button!
*/
import type {
ManifestWorkspaceAction,
ManifestWorkspaceActionMenuItem,
MetaWorkspaceActionDefaultKind,
UmbWorkspaceActionDefaultKind,
@nul800sebastiaan
nul800sebastiaan / AddTableMigration.cs
Created February 4, 2025 10:54
AddTableMigration
using NPoco;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Migrations;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Infrastructure.Migrations;
using Umbraco.Cms.Infrastructure.Migrations.Upgrade;
@nul800sebastiaan
nul800sebastiaan / gist:8caf7ab8d5e152029c2c998d60ca8f1b
Created July 11, 2024 10:10
Code block with syntax highlighting on Discord
```js
#onChange(event: InputEvent) {
if (event.target && event.target instanceof HTMLElement) {
const target = event.target;
const firstShadowRoot = target.shadowRoot;
if (firstShadowRoot) {
const umbInputDocument = firstShadowRoot.querySelector('umb-input-document');
if (umbInputDocument && umbInputDocument.shadowRoot) {
const refList = umbInputDocument.shadowRoot.querySelector('uui-ref-list');
if (refList) {
@nul800sebastiaan
nul800sebastiaan / MediaUploadHandler.cs
Created March 27, 2024 11:26
Umbraco 9+ rename media item to filename
using System.Text.Json;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;
namespace MySite;
public class FilenameHandler : IComposer
{
@nul800sebastiaan
nul800sebastiaan / RegisterDependencies.cs
Created January 12, 2024 11:36
Register Slimsy (and other dependencies) using a Composer
using Slimsy.DependencyInjection;
using Umbraco.Cms.Core.Composing;
namespace MyProject;
public class RegisterDependencies : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.AddSlimsy();
@nul800sebastiaan
nul800sebastiaan / Scheduler.cs
Last active November 19, 2023 11:39
Job scheduler compatible with Umbraco upgrading or doing first boot
using Hangfire;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Services;
namespace UmbraCalendar.Jobs;
public class Scheduler : IComposer
{
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#DA627D",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
using System.Text.Json.Serialization;
using J2N.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace Cultiv.Controllers;
[ApiController]
[Route(".well-known/[controller]")]
[Produces("application/json")]
@nul800sebastiaan
nul800sebastiaan / keys.pub
Created November 5, 2022 08:51
keys.pub verification
BEGIN MESSAGE.
QkdLqCt3lF4Xp7t Vlh2wiA6frPZWbb kFCMyGHaPwmGgSP LsFYHjUo0BKQ1lx
18yd71fqWXmD3iW hMQEafmtZ5PTCKq 6Xr2MZHgg77vfn7 Zbp4ahAceopUB9L
2e8iD4hNCSKT7Pc id7EsqGyMRXgYmI XZcKeV0HZXNtzXk y823ngxPxGDA0q0
bH58l6v9xdAN8Ng GzGtGzfl29dtpFm zkRYg3KrLsWxFio Lq4AH.
END MESSAGE.
@nul800sebastiaan
nul800sebastiaan / AwesomeSauce.cs
Created November 4, 2022 08:28
Hangfire Dependency Injection Example
using Hangfire;
using Hangfire.Console;
using Hangfire.Server;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core.Composing;
namespace Collaborators.Web;
public interface IAwesomeService
{