Skip to content

Instantly share code, notes, and snippets.

View sotirisf's full-sized avatar

Sotiris Filippidis sotirisf

View GitHub Profile
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text.RegularExpressions;
using Moq;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web;
using Umbraco.ModelsBuilder;
@sotirisf
sotirisf / package.manifest
Created August 11, 2018 23:06
Package Manifest for Umbraco Hide Properties JS injection
{
//array of files we want to inject into the application on app_start
javascript: [
"~/App_Plugins/HideProperties/arrive.js",
"~/App_Plugins/HideProperties/HidePropertiesJsOutput.ashx"
]
}
@sotirisf
sotirisf / HidePropertiesJsOutput.ashx.cs
Last active August 11, 2018 23:06
Code behind for Umbraco dynamically- generated Javascript for hiding back-end properties
using System.Configuration;
using System.Web;
namespace MyNamespace
{
public class HidePropertiesJsOutput : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/javascript";
@sotirisf
sotirisf / ImageData.cs
Created February 4, 2018 14:49
Umbraco Responsive Background Images Helper Class
using System.Collections.Generic;
using System.Text;
using System.Web;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace DotSee.Common
{
public class ImageData
{
@sotirisf
sotirisf / Umbraco_Responsive_Background_Images_Example.cshtml
Last active February 4, 2018 15:07
Umbraco Responsive Background Images Example
@using DotSee.Common
@inherits Umbraco.Web.Mvc.UmbracoViewPage<SomeStronglyTypedModel>
@{
ImageData imageData = Model.Image.GetImageData();
}
@Html.Raw(imageData.GetBreakPointsCss(breakPoints: "320:480,480:768,768:960,960:1280,1280:1366,1366:1600,1600:1920", viewWidth:100))
@sotirisf
sotirisf / ImageExtensions.cs
Last active February 4, 2018 15:07
Umbraco Responsive Background Images (Extension Method)
using System;
using System.Web;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.Models;
namespace DotSee.Common
{
public static class ImageExtensions
{
@sotirisf
sotirisf / GetDictionaryEntries.sql
Created January 12, 2018 22:57
Get Umbraco dictionary entries for all languages in a pivoted table (each language with its own column)
DECLARE @DynamicColumns NVARCHAR(MAX);
DECLARE @DynamicSQL NVARCHAR(MAX);
SELECT @DynamicColumns = COALESCE(@DynamicColumns+', ', '')+QUOTENAME(languageISOCode)
FROM
(
SELECT DISTINCT
languageISOCode
FROM umbracolanguage
) AS FieldList;
@sotirisf
sotirisf / DotSee.ImageExtensions.cs
Created November 14, 2017 15:47
Umbraco image srcset with image cropper
using System.Linq;
using System.Text;
using System.Web;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace DotSee.Common
{
public static class ImageExtensions
{
@sotirisf
sotirisf / FixNodeswithoutTemplates.cs
Created September 6, 2017 20:47
Bulk update documents with their default template in case they have no template assigned
using System.Linq;
using System.Reflection;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace DotSee.Common
{
public class FixNodesWithoutTemplates : ApplicationEventHandler
@sotirisf
sotirisf / ContentHelper.cs
Created August 28, 2016 20:32
Umbraco Picker Extensions
using System.Web;
using Umbraco.Web;
namespace DotSee.UmbracoExtensions
{
/// <summary>
/// Helps with Umbraco content.
/// </summary>
public static class ContentHelper
{