Skip to content

Instantly share code, notes, and snippets.

@callumbwhyte
callumbwhyte / VendrDiscountImporter.cs
Last active August 6, 2021 15:45
Example of importing discounts to Vendr programatically
using System;
using System.Collections.Generic;
using Umbraco.Core;
using Vendr.Core;
using Vendr.Core.Api;
using Vendr.Core.Models;
public class DiscountImporter
{
private readonly IVendrApi _vendr;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models.Blocks;
using Umbraco.Core.Models.PublishedContent;
public static class PublishedElementExtensions
{
public static IPublishedElement GetElement(this IEnumerable<IPublishedElement> elements, string alias)
{
return elements.GetElements(alias).FirstOrDefault();
@callumbwhyte
callumbwhyte / Get-KeyInSource.ps1
Last active January 19, 2019 16:20
Powershell script to detect unused Umbraco language file dictionary keys
Function Get-KeyInSource($sourcePath, $key)
{
# Separate key alias from area
$keyParts = $key.Split("/")
$areaAlias = $keyParts[0]
$keyAlias = $keyParts[1]
# Add conditions to an array
$conditions = @($key)
using System;
using System.Configuration;
using System.Linq;
using System.Runtime.Caching;
namespace CBW.Cache
{
public class MemoryCacheHelper
{
public object GetValue(string key)