Skip to content

Instantly share code, notes, and snippets.

View markadrake's full-sized avatar
🇺🇸

Mark Drake markadrake

🇺🇸
View GitHub Profile
@markadrake
markadrake / Example.cshtml
Created March 11, 2024 17:02
Umbraco — Blocks in Rich Text Editor
@*
Block alias: `Example`
File path: Views/Partials/RichText/Components/Example.cshtml
*@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.RichTextBlockItem>
@{
var blockListItem = new BlockListItem(Model.ContentUdi, Model.Content, Model.SettingsUdi, Model.Settings);
}
<partial name="~/views/partials/blocklist/components/example.cshtml" model="blockListItem" />
@markadrake
markadrake / With JavaScript.js
Created December 1, 2022 05:47
Touch Friendly Sharepoint Dropdowns
var linksWithChildren = document.querySelectorAll("li.dynamic-children > a");
for (var i = 0; i < linksWithChildren.length; i++){
linksWithChildren[i].setAttribute("aria-haspopup","true")
}
@markadrake
markadrake / TextboxWithCharacterCount.controller.js
Created December 1, 2022 02:37
Custom Umbraco Property Editor Tutorial: Character Counts
angular.module("umbraco").controller("Scylla.TextboxWithCharacterCount", function ($scope)
{
// Loads Default Max Count
$scope.model.maxCount = $scope.model.config.maxCount;
// Attempts to re-define Max Count by description text
if ($scope.model.description)
{
var maxSetInDescription = $scope.model.description.match(/\d+/);
@markadrake
markadrake / sitemap.cshtml
Last active April 11, 2022 22:53
Umbraco 9 | Sitemap in Razor
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@{
Layout = "template.cshtml";
var currentPage = Umbraco.AssignedContentItem;
var root = currentPage.AncestorOrSelf(1);
}
<div class="sitemap">
@markadrake
markadrake / ConfirmationFieldType.cs
Last active January 30, 2022 05:30
Umbraco 9 > Umbraco Forms > Custom Confirmation Field Type
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Forms.Core;
using Umbraco.Forms.Core.Enums;
using Umbraco.Forms.Core.Models;
using Umbraco.Forms.Core.Providers;
@markadrake
markadrake / input.scss
Created January 9, 2022 19:55
Generated by SassMeister.com.
.myUniqueClassName {
background: black;
color: white;
h1, h2, h3, h4, h5, h6, p, li, span, label {
font-size: 1rem;
}
}
@markadrake
markadrake / gist.html
Created September 2, 2017 16:30
Responsive Type through SVG
<!--
Responsive Type through SVG
CodePen: https://codepen.io/markadrake/pen/dWgyvK
-->
<html>
<head>
<meta charset="UTF-8">
<title>CodePen - SVG Text Spacing</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
@markadrake
markadrake / gist.js
Created September 2, 2017 15:48
Concatenate Arrays using the Spread Operator in JavaScript
// Concatenate Arrays using the Spread Operator in JavaScript
// CodePen: https://codepen.io/markadrake/pen/mMvYRQ
// Gist: https://gist.github.com/
let myArray = [1],
mySecondArray = [2, 3],
myLastArray = [...myArray, ...mySecondArray]; // [1, 2, 3]
@markadrake
markadrake / Rotate a Doughnut Chart (Chart.JS).markdown
Created June 5, 2015 17:28
Rotate a Doughnut Chart (Chart.JS)

Rotate a Doughnut Chart (Chart.JS)

Just a quick pen to illustrate a new property we can use to rotate a doughnut chart. This example is specific to the Chart.JS library.

A Pen by Mark Drake on CodePen.

License.