Skip to content

Instantly share code, notes, and snippets.

View nul800sebastiaan's full-sized avatar
🔥

Sebastiaan Janssen nul800sebastiaan

🔥
View GitHub Profile
@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
{
@nul800sebastiaan
nul800sebastiaan / MyIndex.cs
Last active October 11, 2022 14:12
Custom Examine Index Umbraco 10.2.0
using Examine;
using Examine.Lucene;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Index;
using Lucene.Net.Util;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Scoping;
@nul800sebastiaan
nul800sebastiaan / MemberGroupIndexerComposer.cs
Last active September 12, 2022 10:56
Add member groups to Umbraco's internal member index
using Examine;
using Examine.Lucene;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Web;
namespace MyProject;