Skip to content

Instantly share code, notes, and snippets.

View ProNotion's full-sized avatar

ProNotion

  • Prolific Notion Ltd
  • Plymouth, UK
View GitHub Profile
@leekelleher
leekelleher / cmsContentType_Usage.sql
Last active January 19, 2024 19:03
Umbraco - database analysis - SQL Queries
-- Copied from Hendy https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/72814-creating-a-list-of-unused-doc-types#comment-233729
-- Find all unused docTypes
-- These results may contain docTypes that are masters of used ones, so need to exclude these too...
SELECT
A.nodeId as 'DocTypeId',
B.text AS 'Name',
A.alias AS 'Alias'
FROM
cmsContentType A LEFT JOIN
@sniffdk
sniffdk / ContextHelpers.cs
Last active February 28, 2022 10:03
Fake an UmbracoContext for use when doing published scheduling or other scenarios where UmbracoContext is normally null.
public class ContextHelpers
{
public static UmbracoContext EnsureUmbracoContext() {
if (UmbracoContext.Current != null)
{
return UmbracoContext.Current;
}
var httpContext = new HttpContextWrapper(HttpContext.Current ?? new HttpContext(new SimpleWorkerRequest("temp.aspx", "", new StringWriter())));
@kipusoep
kipusoep / web.config.xml
Last active February 26, 2024 17:08
SEO redirects for web.config
<!-- SEO rules (from: http://www.seomoz.org/blog/what-every-seo-should-know-about-iis#chaining) -->
<!-- SEO | Section 1 | Whitelist -->
<rule name="Whitelist - Resources" stopProcessing="true">
<match url="^(?:css/|scripts/|images/|install/|config/|umbraco/|umbraco_client/|base/|webresource\.axd|scriptresource\.axd|__browserLink|[^/]*/arterySignalR/.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
<!-- SEO | Section 2 | Rewrites (chaining) -->
<rule name="SEO - Remove default.aspx" stopProcessing="false">
<match url="(.*?)/?default\.aspx$" />
@sniffdk
sniffdk / Indexing.cs
Last active April 1, 2021 10:32
Small snippet for reindexing an entity in Examine
public void ReIndexEntity(IContentBase entity)
{
if (entity is IContent)
{
ExamineManager.Instance.ReIndexNode((entity as IContent).ToXml(), "content");
}
else if (entity is IMedia)
{
ExamineManager.Instance.ReIndexNode((entity as IMedia).ToXml(), "media");
}
@nsbingham
nsbingham / ngrok-with-IISExpress.md
Last active December 18, 2020 20:29
How to get ngrok working with IISExpress/Visual Studio 2013
  1. Decide on a subdomain to use with ngrok. This makes the whole process easier.
  2. Open up a Command Prompt in Administrator mode and run the following command to register the URL with HTTP.sys replacing "modernie" with your subdomain and ##### with your VisualStudio/IISExpress application's port.
netsh add urlacl url=http://modernie.ngrok.com:##### user=everyone
  1. Edit your applicationhost.config. The easiest way to is start up the site and right-click the IISExpress icon in the System Tray. Click "Show All Applications" and select your website running at localhost:#####. Click the path next to "Config" to open the file in an editor.
  2. Search for you site's <bindings> configuration. The easiest way is to search for *:#####:localhost, which should bring you to the <bindings> section for your site. Edit them to include the following:
DF_cmsMacroProperty_macroPropertyHidden was called DF_macroProperty_macroPropertyHidden at some point (cmsMacroProperty table)
FK_cmsMacroProperty_cmsMacroPropertyType_id was called FK_umbracoMacroProperty_umbracoMacroPropertyType at some point (cmsMacroProperty table)
FK_cmsTagRelationship_umbracoNode_id was called umbracoNode_cmsTagRelationship at some point (cmsTagRelationship table)
So just rename these three from their old name (on the right) to their "expected" name (left)
@BjornFridal
BjornFridal / gist:a1fac50d99d7aff40cc8
Last active November 8, 2021 17:35
Adding css classes to paragraph tag (no spans!) in RTE/TinyMCE in Umbraco v.7+
// In \Umbraco\Js\umbraco.controllers.js find this code (line 5429-5432 in version 7.1.3):
else if (rule.selector[0] == "#") {
r.inline = "span";
r.attributes = { id: rule.selector.substring(1) };
}
// directly after, add this:
else if (rule.selector.indexOf("p.") == 0) {
r.classes = rule.selector.substring(2);
r.block = 'p';
@ryanlewis
ryanlewis / umbraco-jul-fix.ps1
Created July 22, 2014 10:54
Powershell script to resolve the Umbraco security advisory released 21 July 2014
Param(
[Parameter(Mandatory=$true)] $path
)
$proxyHtm = @"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Repo proxy</title>
</head>
@Shazwazza
Shazwazza / gist:931885e682b8fe34220e
Created September 10, 2014 00:01
CachedPartial with contextualKeyBuilder
@Html.CachedPartial(
//partial view name
"myPartialView",
//the model to pass the view - this will be the same object passed to the contextualKeyBuilder delegate
Model,
//seconds to cache
123,
//the key builder delegate, accepts the model passed in to the cached partial and the current
// viewdata dictionary of the partial view
contextualKeyBuilder: (model, viewdata) =>