Skip to content

Instantly share code, notes, and snippets.

View nathanwoulfe's full-sized avatar

Nathan Woulfe nathanwoulfe

View GitHub Profile
@nathanwoulfe
nathanwoulfe / change-content-type.cs
Created March 15, 2022 21:34
Change content type via reflection
public class ChangeContentTypeController : UmbracoAuthorizedApiController
{
private readonly IContentTypeService _contentTypeService;
private readonly IContentService _contentService;
public ChangeContentTypeController(IContentTypeService contentTypeService, IContentService contentService) {
_contentTypeService = contentTypeService;
_contentService = contentService;
}
@nathanwoulfe
nathanwoulfe / scripts.sql
Created October 19, 2022 06:52
Inheritance to composition
-- CREATES THE COMPOSITION FROM THE INHERITED TYPE
DECLARE @CompositionId int;
DECLARE @CompositionsFolder int;
DECLARE @PropertyTab int;
DECLARE @CompositionGUID uniqueidentifier;
-- Generate a unique guid for the metadata composition
SET @CompositionGUID = 'f583bcf5-b007-47d4-992e-c193f225f76c'
DECLARE @PropertyTagGUID uniqueidentifier;
@nathanwoulfe
nathanwoulfe / parent-scope.js
Created April 3, 2023 08:48
Get ancestor scope in AngularJs
  getEditorScope = $scope => {
    let editorScope = $scope.$parent;
    do {
      editorScope = editorScope.$parent;
    } while (!Object.prototype.hasOwnProperty.call(editorScope, 'contentForm'));
    this.editorScope = editorScope;
  }