Skip to content

Instantly share code, notes, and snippets.

@whyleee
whyleee / WebpackController.cs
Created Sep 27, 2018
Inject Webpack output HTML into ASP.NET MVC
View WebpackController.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web.Hosting;
using System.Web.Mvc;
View CachedUrlResolver.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using EPiServer;
using EPiServer.Core;
using EPiServer.Framework.Cache;
using EPiServer.Globalization;
using EPiServer.Web;
@whyleee
whyleee / async-data-mixin.js
Created Dec 3, 2018
Async data mixin with content area handling (is it really needed on client side? because mixin as applied to all components)
View async-data-mixin.js
import blockRouter from '@/router/block-router'
// TODO ssr move to lib and reuse with entry-server.js
function loadBlocksAsyncData({ store, route, model }) {
const contentAreas = Object.keys(model)
.filter(key => key.endsWith('ContentArea'))
.map(key => model[key])
const blockPromises = contentAreas
.map(blocks => blockRouter.resolveComponents(blocks))
View .gitconfig
[user]
name = Pavel Nezhencev
email = pavel.nezhencev@creuna.com
[core]
autocrlf = true
editor = code --wait
[push]
default = simple
[alias]
ll = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
@whyleee
whyleee / MigrateHeroPanelOverlayJob
Created Feb 1, 2017
Example Episerver job for block property migration
View MigrateHeroPanelOverlayJob
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAccess;
using EPiServer.PlugIn;
using EPiServer.Scheduler;
@whyleee
whyleee / FixedGoogleAnalyticsContextController.cs
Created Nov 24, 2016
Fix for Episerver Google Analytics context gadget for multi-hostname websites or dedicated edit server.
View FixedGoogleAnalyticsContextController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using EPiServer.Core;
using EPiServer.GoogleAnalytics.Models;
namespace EPiServer.GoogleAnalytics.Controllers
{
// Fixes Google Analytics context gadget for multi-hostname websites or dedicated edit server.
@whyleee
whyleee / IocConfig.cs
Created May 20, 2016
StructureMap dependency resolver for Episerver with MVC/Web API
View IocConfig.cs
[ModuleDependency(typeof(EPiServer.Commerce.Initialization.InitializationModule))]
public class IocConfig : IConfigurableModule
{
public void ConfigureContainer(ServiceConfigurationContext context)
{
context.Container.EjectAllInstancesOf<ICatalogContentBuilder>();
context.Container.Configure(ConfigureContainer);
DependencyResolver.SetResolver(new StructureMap.StructureMapDependencyResolver(context.Container));
@whyleee
whyleee / WriteObject.cs
Last active Oct 14, 2015
Function to write RDB C# objects to console
View WriteObject.cs
private static void WriteObject(object obj, int indent = 0, string suffix = null)
{
foreach (var prop in obj.GetType().GetProperties())
{
var value = prop.GetValue(obj);
if (prop.PropertyType.FullName.StartsWith("RDB") && !prop.PropertyType.IsEnum && value != null)
{
Console.Write(new string(' ', indent));
Console.WriteLine(prop.Name + ":");
@whyleee
whyleee / js-git-node-request.js
Created Aug 9, 2015
js-git node.js request implementation
View js-git-node-request.js
var https = require('https');
var urlParse = require('url').parse;
function request(method, url, headers, body, callback) {
if (typeof body == 'function') {
callback = body;
body = undefined;
}
var parsedUrl = urlParse(url);
@whyleee
whyleee / ExportMediaJob.cs
Created Jul 23, 2015
EPiServer jobs to migrate Commerce assets between servers
View ExportMediaJob.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.Hosting;
using EPiServer;
using EPiServer.BaseLibrary.Scheduling;
using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.Core;