Skip to content

Instantly share code, notes, and snippets.

View danlister's full-sized avatar

Dan Lister danlister

View GitHub Profile
@using umbraco.cms.businesslogic.media
@{
SaveMedias(Media.GetRootMedias());
}
@functions
{
public void SaveMedias(Media[] medias)
{
if (medias == null || !medias.Any())
[config]
command = Build\deploy.cmd
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\Source\Website\Project.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=%branch% /p:SolutionDir="%DEPLOYMENT_SOURCE%\Solution\.\\" %SCM_BUILD_ARGS%
) ELSE (
call :ExecuteCmd "%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\Source\Website\Project.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=%branch% /p:SolutionDir="%DEPLOYMENT_SOURCE%\Solution\.\\" %SCM_BUILD_ARGS%
)
call :ExecuteCmd copy "%DEPLOYMENT_SOURCE%\Build\Transforms\log4net.%branch%.config" "%DEPLOYMENT_SOURCE%\Source\Website\config\log4net.config"
call :ExecuteCmd copy "%DEPLOYMENT_SOURCE%\Build\Transforms\robots.%branch%.txt" "%DEPLOYMENT_SOURCE%\Source\Website\robots.txt"
Install-Package AgeBase.GolfHoleEditor
var holes = Model.Content.GetPropertyValue<AgeBase.GolfHoleEditor.Models.GolfTees>("alias");
@{
<ul>
@foreach (var hole in holes)
{
<li>
Tee: @hole.Name
<ul>
<li>Par: @hole.Par</li>
<li>Stroke Index: @hole.StrokeIndex</li>
<li>Distance: @hole.Distance yards</li>
@danlister
danlister / 4.11.8.sql
Last active May 22, 2018 18:47
Retrieve a list of Umbraco Documents which have pending changes
DECLARE @NodeId INT
DECLARE my_cursor CURSOR local static read_only forward_only FOR
SELECT DISTINCT nodeid
FROM cmsdocument
OPEN my_cursor
FETCH next FROM my_cursor INTO @NodeId
WHILE @@FETCH_STATUS = 0
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
// The below action works correctly when a template exists
// for the current page. When a template has not been selected
// or does not exist, the ambiguous action method
// exception occurs.
//
// I'm starting think this is correct behaviour because
// MyPageController has an action called Index and so does
// RenderMvcController. Therefore, having duplicate routes.
//
// What I'm not quite certain about is why the exception