Skip to content

Instantly share code, notes, and snippets.

View tcmorris's full-sized avatar
👋

Thomas Morris tcmorris

👋
View GitHub Profile
@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,%'
@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@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
@leekelleher
leekelleher / 1-README.md
Last active August 29, 2015 14:06
Ditto - Example of mapping an Archetype property to custom POCO model/type

Here is an example of using Ditto to map an Archetype property to custom POCO model/type.


Let's say that we have an Archetype to represent some SEO meta-data, and we'll call the DocType property "metaData".

We'd have 3 properties in the Archetype:

  • metaTitle
  • metaDescription
@nul800sebastiaan
nul800sebastiaan / gist:8641249
Last active December 24, 2018 09:53
What's this Umbraco route hijacking all about? (more info in this blog post: http://cultiv.nl/blog/whats-this-umbraco-route-hijacking-all-about/)
// MODEL
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.Models;
namespace Cultiv.Models
{
public class BlogOverview : RenderModel
@sitereactor
sitereactor / NodeDto.cs
Created June 9, 2013 08:23
Example of a POCO that is used internally in Umbraco and decorated with various attributes to enable the creation of a table, columns, keys, constraints and indexes using .CreateTable().
using System;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.DatabaseAnnotations;
namespace Umbraco.Core.Models.Rdbms
{
[TableName("umbracoNode")]
[PrimaryKey("id")]
[ExplicitColumns]
internal class NodeDto
@beccasaurus
beccasaurus / README.markdown
Created May 5, 2011 19:37
Adds hooks to jQuery.validate's form/element validation methods (via trigger())

jQuery Validate Hooks

If you're using [ASP.NET MVC3][], it uses [jQuery Validate][] to do client-side validations. Instead of using [jQuery Validate][] directly, however, it wraps it with its own jQuery plugin called [jQuery.Validate.Unobtrusive][]. [jQuery.Validate.Unobtrusive][] sets up [jQuery Validate][] for you, behind the scenes, so you don't have an opportunity to customize your [jQuery Validate][] settings at all!

We've been running into trouble with this when we've been doing our own custom client-side validations. We need a way to integrate with the build-in [ASP.NET MVC3][] validation so we can: