Skip to content

Instantly share code, notes, and snippets.

View ProNotion's full-sized avatar

ProNotion

  • Prolific Notion Ltd
  • Plymouth, UK
View GitHub Profile
@cssquirrel
cssquirrel / FileUploadApiController.cs
Last active January 25, 2019 11:49
Using AngularJS API service and Umbraco API controller to permit users to upload files to the server
// Use whatever namespacing works for your project.
namespace YourSite.Web.Controllers.Api
{
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
@Hendy
Hendy / DeleteAllVersions.sql
Last active October 28, 2020 10:10
Umbraco - delete version history for all content
-- Create a temporary table for all documents which are published and not in the recycle bin
CREATE TABLE #Nodes (id int)
-- Delete all rows if the table exists before
TRUNCATE TABLE #Nodes
-- Insert all nodeIds from all documents which are published and not in the recycle bin
INSERT INTO #Nodes
SELECT N.id
FROM umbracoNode N
INNER JOIN cmsDocument D ON N.ID = D.NodeId
@davidfowl
davidfowl / dotnetlayout.md
Last active May 9, 2025 16:45
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@jamiepollock
jamiepollock / package.manifest
Created September 19, 2014 16:32
A custom umbraco directive which allows the user to bing an umb-editor to a property whilst providing a custom config.
{
javascript: [
'~/App_Plugins/YourPackage/your.controller.js',
'~/App_Plugins/YourPackage/umbraco-editor-with-config.js',
]
}
@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) =>
@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>
@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';
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)
@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:
@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");
}