Skip to content

Instantly share code, notes, and snippets.

barryokane / app_offline.htm
Last active June 15, 2018 03:25
Simple app_offline.htm with no-cache meta tags, to discourage browsers from caching the maintenance message.
View app_offline.htm
<title>Maintenance underway</title>
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
barryokane / Check list of URLs for
Last active October 28, 2022 10:47
Powershell script to loop over a list of URLs, make a HTTP HEAD request and check for (first) 301 response.
View Check list of URLs for
# Script to loop over a list of URLs, make a HTTP HEAD request and check for (first) 301 response
# INPUT: A txt file with one URL per line
# OUTPUT: A CSV file with columns for:
# - RequestURI = the URI from than line in input file
# - StatusCode = response status code (blank if error code!)
# - Error = Error message (for 404 or 500 errors)
barryokane / PatternLibRazorViewEngine.cs
Created March 11, 2017 04:56
Inspired by Heather Floyd's article (, however our use case is slightly different: we want to share a library of partials between multiple Umbraco sites with custom overrides on specific sites
View PatternLibRazorViewEngine.cs
using System.Linq;
using Umbraco.Web.Mvc;
namespace Endzone.Umbraco.PatternLib
public class PatternLibRazorViewEngine : RenderViewEngine
public PatternLibRazorViewEngine() : base()
barryokane / nav_partial.cshtml
Last active April 14, 2016 00:34
Getting Nested Content property values from child pages.
View nav_partial.cshtml
var root = Model.Content.AncestorOrSelf(1);
var pages = root.DescendantsOrSelf("DocTypeAlias");
foreach (var p in pages) {
var items = p.GetPropertyValue<IEnumerable<IPublishedContent>>("NestedContentPropertyName");
<div class="outer">
<h1><a href="@p.Url">@Umbraco.Field(p,"HeadingText")</a></h1>
<ul class="innerList">
@if (items != null) {
foreach(var item in items) {
barryokane / EventsList_all.cshtml
Created April 12, 2016 20:31
Combining “FullCalendar” with “KS.Umbraco7.Calendar” to create a great Umbraco events listing
View EventsList_all.cshtml
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using KS.Umbraco7.Calendar.Core
Layout = "Layout.cshtml";
@section styles {
<link rel='stylesheet' href='//' />
<link media="print" rel='stylesheet' href='//' />
barryokane / umbraco.helper.sample.before.cshtml
Last active March 15, 2017 15:52
Simple example of using Razor @Helper in an Umbraco template. In this example we have some repeating HTML, using @Helper removes the duplication.
View umbraco.helper.sample.before.cshtml
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
Layout = "Layout.cshtml";
<section id="content" class="offers">
View OnePageImpactReport.Models.cs
namespace OnePageImpactReport.Models
[UIOMaticAttribute("ImpactOrganisations", "icon-users", "icon-user")]
[PrimaryKey("Id", autoIncrement = true)]
public class ImpactOrganisation : IUIOMaticModel
barryokane / uWhiteLabel.Install.InstallControl.ascx
Created March 22, 2016 15:58
An example User Control used for "Load control after installation" when creating an Umbraco package. (See
View uWhiteLabel.Install.InstallControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" Inherits="uWhiteLabel.Install.InstallControl" %>
<h3>uWhiteLabel Installed Successfully!</h3>
<hr />
<p class="umb-abstract">Instructions</p>
<li>...more stuff here...</li>
barryokane / uWhiteLabelDashboardAction.cs
Created March 22, 2016 15:08
Umbraco install package action that adds a new "tab" to the dashboard (not a "Section"). Used in:
View uWhiteLabelDashboardAction.cs
using System.Xml;
using umbraco.interfaces;
using Umbraco.Core.IO;
using Umbraco.Core;
using uWhiteLabel.Properties;
namespace uWhiteLabel.Install
public class uWhiteLabelDashboardAction : IPackageAction
barryokane / 0_reuse_code.js
Created February 1, 2016 21:45
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console