Skip to content

Instantly share code, notes, and snippets.

@adactio
adactio / redirect.php
Last active January 2, 2024 23:24
A proxy that tries to redirect bad links to the internet archive.
<?php
// Check that the request is coming from my site.
if (!isset($_SERVER['HTTP_REFERER']) || !stristr(strtolower($_SERVER['HTTP_REFERER']), strtolower($_SERVER['SERVER_NAME']))) {
http_response_code(403);
exit;
}
// There has to be a URL provided in the query string.
if (!isset($_GET['url'])) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Code Sandbox</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
@skttl
skttl / MigrateVendrToCommerce.cs
Last active February 15, 2024 09:19
Migrate Vendr database to Umbraco Commerce
using System;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Migrations;
using Umbraco.Cms.Core.Scoping;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Infrastructure.Migrations;
using Umbraco.Cms.Infrastructure.Migrations.Upgrade;
namespace Umbraco.Community.Migrations;
@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
@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 "[email protected]"
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD "test123456"
dotnet add package Umbraco.TheStarterKit
@hfloyd
hfloyd / PageTypesDataSource.cs
Last active May 20, 2021 21:15
Contentment Custom IDataListSource: Umbraco Page Types
namespace YourCode
{
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Community.Contentment.DataEditors;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
@mattbrailsford
mattbrailsford / XPathLookupDataSource.cs
Created March 4, 2021 09:13
nuPickers data source to lookup values from a Nest Content property
using nuPickers.Shared.DotNetDataSource;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace Outfield.Digital.DataSources
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Umbraco.Community.Contentment.DataEditors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web;
namespace MyWebsite.DataSources
{
@tomhicks
tomhicks / plink-plonk.js
Last active November 12, 2024 19:08
Listen to your web pages
@Attackmonkey
Attackmonkey / Get All Unpublished Content
Created July 16, 2019 07:27
Some queries for getting unpublished content from the Umbraco DB
--ALL UNPUBLISHED CONTENT (COMPLETELY UNPUBLISHED)
SELECT un.id, un.text FROM umbracoNode un
INNER JOIN cmsDocument cd ON un.id = cd.nodeId
WHERE cd.newest = 1 AND cd.published = 0
AND (SELECT COUNT(a.nodeId) FROM cmsDocument a WHERE a.nodeId = un.id AND a.published = 1 AND a.newest = 0) = 0
--ALL UNPUBLISHED CONTENT (COMPLETELY UNPUBLISHED), EXCLUDING DELETED ITEMS
SELECT un.id, un.text FROM umbracoNode un
INNER JOIN cmsDocument cd ON un.id = cd.nodeId
WHERE cd.newest = 1 AND cd.published = 0 AND un.path NOT LIKE '%-21,%'