Skip to content

Instantly share code, notes, and snippets.

View mattbrailsford's full-sized avatar

Matt Brailsford mattbrailsford

View GitHub Profile
var products = catalog.GetRootCategories()
.SelectMany(x => x.CategoryProductRelations
.Where(y => y.Category.DisplayOnSite)
.Select(y => y.Product));
@using System.Configuration
@using Twitterizer
@inherits Umbraco.Web.Mvc.UmbracoViewPage<Umbraco.Web.Models.PartialViewMacroModel>
@{
var tokens = new OAuthTokens
{
ConsumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"],
ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"],
AccessToken = ConfigurationManager.AppSettings["twitterAccessToken"],
AccessTokenSecret = ConfigurationManager.AppSettings["twitterAccessTokenSecret"]
namespace Our.Umbraco.AutoTweet.Web
{
public class AppBase : ApplicationBase
{
public AppBase()
{
RegisterAssemblyReslover();
}
private void RegisterAssemblyReslover()
var testimonials = Model.Content.AncestorOrSelf(1)
.Sibling("Repository")
.Descendants("Testimonial");
<Target Name="UpdateAssemblyInfo">
<FileUpdate
Encoding="ASCII"
Files="$(ProjectDir)\Properties\AssemblyInfo.cs"
Regex="AssemblyVersion\(&quot;.*&quot;\)\]"
ReplacementText="AssemblyVersion(&quot;$(PackageVersion).0.0&quot;)]" />
<FileUpdate
Encoding="ASCII"
Files="$(ProjectDir)\Properties\AssemblyInfo.cs"
Regex="AssemblyFileVersion\(&quot;.*&quot;\)\]"
public static class UmbracoHelperExtensions
{
// These extensions methods are here to bypass an issue with Umbraco.TypedContent method
// wherby if an item is in the trashcan, a YSOD is thrown. The issue has been reported here
// http://issues.umbraco.org/issue/U4-1300
// Once fixed, any uses of TypeContent2 can just be replaced with TypedContent calls
public static IEnumerable<IPublishedContent> TypedContent2(this UmbracoHelper helper, IEnumerable<string> ids)
{
return helper.TypedContent2(ids.ToArray());
}
SELECT MAX(id) FROM [umbracoNode]
@{
var myModel = new MyModelObj();
myModel.SomeProp = "Hello";
}
@Html.CachedPartial("MyPartialName", myModel, 3600)
@{
myModel.SomeProp = "World";
}
@Html.CachedPartial("MyPartialName", myModel, 3600)
@mattbrailsford
mattbrailsford / MultiUrlPickerPropertyEditorValueConverter.cs
Created June 7, 2013 17:33
An IPropertyEditorValueConverter for the uComponents MultiUrlPicker for Umbraco
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;
using Umbraco.Core;
using Umbraco.Core.Dynamics;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web;
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/>
</startup>
</configuration>