Skip to content

Instantly share code, notes, and snippets.

@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
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
@enkelmedia
enkelmedia / Umbraco - Empty Recycle Bin.sql
Last active April 11, 2023 12:13
Umbraco - Empty Recycle Bin.sql
/*
2018-12-06
This SQL will remove all content and media that's in the recycle bin
Tested on: Umbraco 7.12.3
NOTE:
You might want to empty the recycle bin in the media-section manually since the files on disk will not be deleted when executing this SQL-query.
PRO-TIP: Execute each line one by one by selecting the row and hit CTRL+E
*/
@JimBobSquarePants
JimBobSquarePants / DominantColor.cs
Created June 7, 2018 11:58
Get dominant color from an image using ImageSharp and ImageProcessor
// ##### ImageSharp #####
using (var image = Image.Load<Rgb24>(inPath))
{
image.Mutate(
x => x
// Scale the image down preserving the aspect ratio. This will speed up quantization.
// We use nearest neighbor as it will be the fastest approach.
.Resize(new ResizeOptions() { Sampler = KnownResamplers.NearestNeighbor, Size = new Size(100, 0) })
@enkelmedia
enkelmedia / Umbraco - Delete Older Versions.sql
Last active May 16, 2024 19:54
Remove older content versions from the Umbraco database (tested on v7.9.2)
-- set how many versions to keep using @numberOfVersionToKeep, this can be set to anything from 0 and above. 0 will clean all versions except the current of course.
-- actually delete stuff by modifying last line to 'commit tran'
begin tran
go
DECLARE @numberOfVersionToKeep int = 20
IF OBJECT_ID('tempdb..#tmp') IS NOT NULL DROP Table #tmp
create table #tmp (versionid uniqueidentifier)
@dampee
dampee / umbraco db cleanup.sql
Last active November 9, 2021 12:57
Umbraco Database cleanup. After pulling in an umbraco database from production, you don't need all history or log.
-- Umbraco Clear Old Document Versions To Decrease Database Size And Improve Performance
-- http://borism.net/2008/12/16/fixing-a-large-cmspropertydata-table-in-umbraco/
DECLARE @createdDate Datetime = DATEADD(m, -1, getdate())
-- dump logs
-- TRUNCATE TABLE umbracolog -- faster if log table is very big and you don't need anything
DELETE FROM umbracolog WHERE Datestamp < @createdDate
-- clean up old versions
DELETE FROM cmsPropertyData WHERE