Skip to content

Instantly share code, notes, and snippets.

View nul800sebastiaan's full-sized avatar
🔥

Sebastiaan Janssen nul800sebastiaan

🔥
View GitHub Profile
@nul800sebastiaan
nul800sebastiaan / gist:1553316fda85011270ce2bde35243e5b
Created October 15, 2021 13:07
Fully unattended Umbraco 9 + Starter Kit install with automatic DB creation in SQL server
dotnet new umbraco -n UmbracoUnattended --connection-string "Server=GORDON\SQLExpress;Database=UmbracoUnattended;User Id=sa;Password=abc123;"
cd UmbracoUnattended
Set-Item Env:\UMBRACO__CMS__GLOBAL__INSTALLMISSINGDATABASE true
Set-Item Env:\UMBRACO__CMS__UNATTENDED__INSTALLUNATTENDED true
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERNAME "Test"
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL "test@test.com"
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD "test123456"
dotnet add package Umbraco.TheStarterKit
@nul800sebastiaan
nul800sebastiaan / BlogOverviewController.cs
Created October 5, 2021 09:39
BlogOverviewController.cs
using System;
using System.Linq;
using Cultiv.Site.Models;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Logging;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Web;
using System;
using Hangfire;
using Hangfire.Console;
using Hangfire.SqlServer;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Web.BackOffice.Authorization;
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<language alias="vi_vn" intName="Vietnam (Vietnamese)" localName="Vietnam (Vietnamese)" lcid="" culture="vi-VN">
<creator>
<name>The Umbraco community</name>
<link>https://our.umbraco.com/documentation/Extending-Umbraco/Language-Files</link>
</creator>
<area alias="actions">
<key alias="assignDomain">Culture and Hostnames</key>
<key alias="auditTrail">Audit Trail</key>
<key alias="browse">Browse Node</key>
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web.Hosting;
using System.Web.Http;
using Umbraco.Web.WebApi;
### Keybase proof
I hereby claim:
* I am nul800sebastiaan on github.
* I am cultiv (https://keybase.io/cultiv) on keybase.
* I have a public key ASAauWBO4XaKeymtplaJ1_H_AutCKhCYBSAvnEI9lIr5ZQo
To claim this, I am signing this object:
@nul800sebastiaan
nul800sebastiaan / gist:c3459731791577582e38254fa6e0ccd6
Last active July 30, 2019 07:27
Example of catch-all route and added constraints
RouteTable.Routes.MapRoute("Default", "{controller}/{action}/{id}",
//Defaults
new { controller = "Home", action = "Index", id = "" },
//Constraints (controller cannot start with UmbProfile, UmbRegister, UmbLogin, UmbLoginStatus or Tags)
new { controller = "^(?!(UmbProfile|UmbRegister|UmbLogin|UmbLoginStatus|Tags))" });
using System.Web.Routing;
using Umbraco.Core.Composing;
using Umbraco.Web.Runtime;
namespace RemoveRoutes
{
// This is required to ensure this composer runs after
// Umbraco's WebFinalComposer which is the component
// that creates all of the routes during startup
[ComposeAfter(typeof(WebFinalComposer))]
using System.Web.Routing;
using Umbraco.Core;
namespace RemoveRoutes
{
public class RemoveRoutesStartupHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
// Reference: https://github.com/umbraco/Umbraco-CMS/issues/5206
using System;
using Umbraco.Core;
using Umbraco.Core.Services;
namespace My.Namespace
{
public class EventHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{