Skip to content

Instantly share code, notes, and snippets.

@kevinSuttle
kevinSuttle / meta-tags.md
Last active November 7, 2024 10:05 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@florisrobbemont
florisrobbemont / Domain.cs
Created March 13, 2013 20:09
Umbraco Get All Domains
/// <summary>
/// Represents a domain
/// </summary>
public class Domain
{
/// <summary>
/// Gets the unique domain id
/// </summary>
public int DomainId { get; set; }
@sitereactor
sitereactor / RemoveNodeFromContentTree.cs
Created June 5, 2013 13:39
Very basic example of removing a node from the Content tree by a DocumentType alias.
using System;
using umbraco.BusinessLogic;
using umbraco.cms.presentation.Trees;
public class SecrectContent : ApplicationBase
{
public SecrectContent()
{
BaseContentTree.AfterNodeRender += BaseContentTree_AfterNodeRender;
}
@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$" />
public class Args : Dictionary<string,object>{}
public class MyIoc
{
private Dictionary<Type, Dictionary<string, Func<Args, object>>> _registry
= new Dictionary<Type, Dictionary<string, Func<Args, object>>>();
public void Register<T>(Func<Args, T> factory, string name = "") where T : class
{
Type t = typeof(T);
@sniffdk
sniffdk / checksize
Last active February 22, 2018 08:19 — forked from anonymous/gist:1391040
declare @RowCount int, @tablename varchar(100)
declare @Tables table (
PK int IDENTITY(1,1),
tablename varchar(100),
processed bit
)
INSERT into @Tables (tablename)
SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'BASE TABLE' and TABLE_NAME not like 'dt%' order by TABLE_NAME asc
declare @Space table (
name varchar(100), rows nvarchar(100), reserved varchar(100), data varchar(100), index_size varchar(100), unused varchar(100)
@sitereactor
sitereactor / MediaEventHandler.cs
Last active July 12, 2023 02:33
Renaming an image when its uploaded to a property with Alias "umbracoFile", but before its saved. The name of the image will be changed to the name of the folder it resides in. This is using the Saving event in the MediaService in Umbraco.
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace Startup
{
public class MediaEventHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
@hmemcpy
hmemcpy / undef.md
Last active November 21, 2023 16:46
Disabling Visual Studio Git Provider

Here's how to disable the package that is responsible for loading the Git source control support in Visual Studio. Use at your own risk!

  • Create a file called devenv.pkgundef and place it next to devenv.exe in you Visual Studio's Common7\IDE (you'll need elevation for this)
  • Add the following entries to the file:
[$RootKey$\Packages\{7fe30a77-37f9-4cf2-83dd-96b207028e1b}]
[$RootKey$\SourceControlProviders\{11b8e6d7-c08b-4385-b321-321078cdd1f8}]
  • Close VS if open, open a Developer command prompt, and type devenv /updateconfiguration
@davidebbo
davidebbo / AzureAutoSettings.cs
Created September 13, 2015 21:42
AzureAutoSettings
using System;
using System.Collections;
using System.Configuration;
using System.Reflection;
using System.Web;
[assembly: PreApplicationStartMethod(typeof(EnvSettings.SettingsProcessor), "Start")]
namespace EnvSettings
{
DELETE FROM umbracoUser2NodeNotify WHERE umbracoUser2NodeNotify.nodeId IN (SELECT TB1.nodeId FROM umbracoUser2NodeNotify as TB1 INNER JOIN umbracoNode as TB2 ON TB1.nodeId = TB2.id WHERE TB2.trashed = '1' AND TB2.nodeObjectType = 'c66ba18e-eaf3-4cff-8a22-41b16d66a972')
DELETE FROM umbracoUser2NodePermission WHERE umbracoUser2NodePermission.nodeId IN (SELECT TB1.nodeId FROM umbracoUser2NodePermission as TB1 INNER JOIN umbracoNode as TB2 ON TB1.nodeId = TB2.id WHERE TB2.trashed = '1' AND TB2.nodeObjectType = 'c66ba18e-eaf3-4cff-8a22-41b16d66a972')
DELETE FROM umbracoAccessRule WHERE umbracoAccessRule.accessId IN (
SELECT TB1.id FROM umbracoAccess as TB1
INNER JOIN umbracoNode as TB2 ON TB1.nodeId = TB2.id
WHERE TB2.trashed = '1' AND TB2.nodeObjectType = 'c66ba18e-eaf3-4cff-8a22-41b16d66a972')
DELETE FROM umbracoAccess WHERE umbracoAccess.nodeId IN (SELECT TB1.nodeId FROM umbracoAccess as TB1 INNER JOIN umbracoNode as TB2 ON TB1.nodeId = TB2.id WHERE TB