Skip to content

Instantly share code, notes, and snippets.

View LucGosso's full-sized avatar
😀

Luc Gosso LucGosso

😀
View GitHub Profile
@LucGosso
LucGosso / PageNotUpdatedReportController.cs
Last active November 21, 2018 08:37
ILM: Episerver Report to monitor pages not updated for a while [https://devblog.gosso.se/?p=961]
using EPiServer;
using EPiServer.Core;
using EPiServer.Security;
using EPiServer.Web.Routing;
using Gosso.Mvc.Business.Initialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
@LucGosso
LucGosso / FotoWare.PlugIns.Episerver.nuspec
Created June 5, 2019 13:36
Use build tasks and nuspec to build Episerver addon in visual studio ( https://devblog.gosso.se/?p=1148 )
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>FotoWare.PlugIns.Episerver</id>
<version>$version$</version>
<title>Episerver Addon integrates Fotoware DAM with Episerver CMS and Commerce</title>
<authors>FotoWare</authors>
<owners>FotoWare</owners>
<iconUrl>https://www.fotoware.com/hubfs/FotoWare_January2018/image/favicon.ico</iconUrl>
<projectUrl>https://learn.fotoware.com/02_FotoWeb_8.0/Integrating_FotoWeb_with_third-party_systems/Episerver_plugin_documentation</projectUrl>
@LucGosso
LucGosso / tracking.js
Last active April 4, 2023 18:42
Google analytics Gist tracking mailto, download, external links and Episerver Form. https://devblog.gosso.se/?p=1232
function epiGat(settings) {
if (settings.downloads || settings.external || settings.mailto) {
var isinternal = new RegExp('^' + window.location.protocol + '\/\/' + window.location.host, 'i');
function addEvent(obj, type, fn) {
if (obj.addEventListener)
obj.addEventListener(type, fn, false);
else if (obj.attachEvent) {
obj['e' + type + fn] = fn;
obj[type + fn] = function () { obj['e' + type + fn](window.event); }
@LucGosso
LucGosso / module.config
Last active February 6, 2020 12:08
Link to containing parent for media and blocks when not used. Blogg post: https://devblog.gosso.se/?p=1291
<?xml version="1.0" encoding="utf-8"?>
<module>
<!--clientResources>
<add name="epi-cms.widgets.base" path="Styles/Styles.css" resourceType="Style"/>
</clientResources-->
<dojo>
<!-- Add a mapping from site to ~/ClientResources/Scripts to the dojo loader configuration -->
<paths>
<add name="clientscripts" path="Scripts" />
</paths>
@LucGosso
LucGosso / FeatureFlagService.cs
Last active August 30, 2020 16:28
Simple Feature Flag Service - blob post https://devblog.gosso.se/?p=1410
using AlloyTemplates.Business;
using EPiServer;
using EPiServer.Core;
using EPiServer.Personalization.VisitorGroups;
using EPiServer.ServiceLocation;
using EPiServer.Web;
using System;
using System.Configuration;
using System.Reflection;
using System.Web;
@LucGosso
LucGosso / ContentRendererService.cs
Created October 27, 2020 21:31
Render Episerver Blocks and ContentArea for use in web api https://devblog.gosso.se/?p=1463
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.Framework.Web;
using EPiServer.Globalization;
using EPiServer.Logging;
using EPiServer.ServiceLocation;
using EPiServer.Web;
using EPiServer.Web.Mvc;
using System.Collections.Generic;
@LucGosso
LucGosso / PriceJob.cs
Created November 29, 2020 17:36
Properly update price in episerver commerce https://devblog.gosso.se/?p=1486
/// <summary>
/// Iterates the prices from ERP into Episerver Commerce
/// </summary>
/// <param name="variant"></param>
/// <param name="item">Custom Entity from ERP system</param>
private static void AddUpdatePrice(VariationContent variant, PriceMessage item)
{
//no need to delete any prices, IPriceService optimizes the prices from the new prices
var priceService = ServiceLocator.Current.GetInstance<IPriceService>();
List<IPriceValue> priceValues = new List<IPriceValue>();
@LucGosso
LucGosso / FeatureConvention.cs
Created November 26, 2021 10:01
ViewEngine code example for featurefolders solutions .net5
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using System;
using System.Linq;
using System.Reflection;
namespace Foundation.Infrastructure.Display
{
public class FeatureConvention : IControllerModelConvention
{
public void Apply(ControllerModel controller)
@LucGosso
LucGosso / MailToHelper.cs
Last active February 5, 2022 17:37
Mailto email obfuscation helper
using System.Text.RegularExpressions;
namespace Gosso.Mvc.Helpers
{
public class MailToHelper
{
private static readonly string replaceTemplate = @"#"" onclick=""window.location = 'mailto:' + ['{0}'].join(''); return false;";
public static string TransformMailToLinks(string text)
@LucGosso
LucGosso / GetFromAzureFileShare.cs
Last active April 1, 2022 05:48
Example how to access share in azure
using Azure.Storage.Files.Shares;
using Azure.Storage.Files.Shares.Models;
public StockInventory[] GetFromAzureFileShare()
{
// Name of the share, directory, and file
string shareName = ConfigurationManager.AppSettings.Get("inRiver.StorageAccountShareReference");
string storageAccountName = ConfigurationManager.AppSettings.Get("inRiver.StorageAccountName");
string storageAccountKey = ConfigurationManager.AppSettings.Get("inRiver.StorageAccountKey");