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'])) {
@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 "test@test.com"
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 March 18, 2024 02:23
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,%'
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu