Skip to content

Instantly share code, notes, and snippets.

Deane Barker deanebarker

Block or report user

Report or block deanebarker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@deanebarker
deanebarker / RenderScriban.cs
Last active Jun 30, 2019
A Scriban module for Wyam
View RenderScriban.cs
using Scriban;
using Scriban.Parsing;
using Scriban.Runtime;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wyam.Common.Configuration;
@deanebarker
deanebarker / XmlNode.cs
Last active Feb 12, 2018
XmlNode Drop to output an XML document in DotLiquid
View XmlNode.cs
public class XmlNode : Drop
{
private const string attributeMethodName = "attr";
private const string xpathQueryMethodName = "xpath";
private const string listQueryMethodName = "list";
private const char shorthandDelimiter = '-';
private XmlElement doc;
public XmlNode(XmlDocument xml)
@deanebarker
deanebarker / StringMatcher.cs
Last active Oct 20, 2017
A class to match strings based on a specified method and options.
View StringMatcher.cs
// If you think it's brilliant, then this is completely intentional.
// If you think it's dumb, then this is intended ironically because I'm just _that_ smart.
StringMatcher.IsMatch("Deane Barker", "deane ", StringMatchMethod.Starts, StringMatchOptions.IgnoreCase | StringMatchOptions.Trim); // True
StringMatcher.IsMatch("Deane Barker", "Barker", StringMatchMethod.Ends); // True
StringMatcher.IsMatch("Deane Barker", "ARK", StringMatchMethod.Contains, StringMatchOptions.IgnoreCase); // True
// etc.
// In reality, this is intended for use with a particular CMS, so that the editing interface can be dynamically generated
// based on the code. A dropdown will generate for the values in StringMatchMethod, and checkboxes will generate for the
@deanebarker
deanebarker / Editor.js
Created Oct 12, 2017
The simplest possible Dojo widget-based editing component for Episerver.
View Editor.js
define(
["dojo/_base/declare", "dojo/ready", "dijit/_Widget", "dijit/_TemplatedMixin", "epi/epi"],
function (declare, ready, _Widget, _TemplatedMixin, epi) {
return declare(
[_Widget, _TemplatedMixin],
{
templateString: '<textarea data-dojo-attach-event="onchange:_onChange"></textarea>',
constructor: function () {
ready(this, function () {
@deanebarker
deanebarker / EpiserverMirroringEventLogging.cs
Created Oct 9, 2017
A library for master logging of Episerver mirroring events
View EpiserverMirroringEventLogging.cs
using EPiServer.Enterprise;
using EPiServer.Enterprise.Mirroring;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.MirroringService;
using EPiServer.MirroringService.Common;
using EPiServer.MirroringService.MirroringMonitoring;
using EPiServer.MirroringService.MirroringTransferProtocol.Common;
using System;
using System.Linq;
@deanebarker
deanebarker / PoorMansCodeEditor.html
Last active Feb 26, 2018
Poor man's code editor in pure JavaScript.
View PoorMansCodeEditor.html
<!--
This is a textarea that:
(1) Is styled(-ish) like a code editor
(2) Catches tabs and converts them to four (4) spaces
(3) Duplicates leading spaces from the last line
(4) Auto-expands to input
Pure inline HTML and JavaScript. No external dependencies. Has issues pre-IE-8, but should be otherwise okay.
@deanebarker
deanebarker / CustomRoutingResolver.cs
Created Sep 27, 2017
Episerver CMS: Route requests to alternate controllers and actions based on page properties.
View CustomRoutingResolver.cs
using EPiServer.Core;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using EPiServer.Web;
using System.Linq;
using System.Web;
namespace BlendInteractive.Business
{
@deanebarker
deanebarker / contentful-reverse-lookup.html
Created Sep 20, 2017
An extension to show content items that are linked to the current item.
View contentful-reverse-lookup.html
<html>
<head>
<link href="https://contentful.github.io/ui-extensions-sdk/cf-extension.css" rel="stylesheet">
<script src="https://contentful.github.io/ui-extensions-sdk/cf-extension-api.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.2.1/mustache.min.js"></script>
<style>
body {
margin: 0;
color: #8091a5 !important;
overflow: hidden;
@deanebarker
deanebarker / CommentForm.html
Last active Sep 12, 2017
The simplest comment implementation I could come up with using Episerver Social with the "Alloy" demo site
View CommentForm.html
<form method="post" action="/social/comments/add" id="commentForm">
<input type="hidden" name="pageId" value="@Model.CurrentPage.ContentGuid"/>
<input type="text" name="author" placeholder="Your name..."/>
<textarea name="body" id="commentBody" placeholder="Your comment..."></textarea>
<br/>
<input type="submit" id="commentSubmitButton" disabled="disabled" style="opacity: 0.5;" value="Submit" />
</form>
<div id="commentList">
Loading comments...
@deanebarker
deanebarker / AirtableGetObjects.cs
Last active Aug 10, 2017
A helper class to create a list of populated objects from an Airtable API call
View AirtableGetObjects.cs
/*
This is very alpha. It's just an idea I was screwing around with in LINQPad.
Airtable might have a full-blown .NET API, for all I know.
Deane
July 19, 2017
*/
You can’t perform that action at this time.