Skip to content

Instantly share code, notes, and snippets.

View asontu's full-sized avatar
🤔
Figuring out Jekyll and Liquid templates and coming to like it

Herman Scheele asontu

🤔
Figuring out Jekyll and Liquid templates and coming to like it
View GitHub Profile
@asontu
asontu / mop.js
Last active June 28, 2021 11:36
Functions to easily make a MutationObserver Promise in JavaScript. Usage described on my blog: https://asontu.github.io/2020/12/30/mutationobserver-promise-made-easy.html
/**
* Runs "trigger" function after setting up MutationObserver and (optionally) Timeout
* that respectively resolve or reject the Promise. The resolve function gets an array
* (not NodeList) of elements that were added as argument. If the trigger function
* returns true the Promise is immediately resolved with an empty array, without waiting
* for a Mutation.
*
* @param {Function} trigger Function to run after setting up MutationObserver and Timeout.
* @param {Object} watch DOM Element to watch for Mutations.
* @param {string} [query=*] Selector query that elements added in the Observed Mutation must match.
@asontu
asontu / ManageWhiteListedIPs.aspx
Last active February 13, 2021 17:50
Admin page to add/remove IP's to IIS's IP address and domain restrictions feature for Identity Server IP white-listing. Further reading here: https://asontu.github.io/2020/12/28/admin-panel-to-whitelist-ips-for-identity-server.html
<%@ Page Language="C#" AutoEventWireup="true" Debug="true" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Data.Linq" %>
<%@ Import Namespace="Microsoft.Web.Administration" %>
<%@ Import Namespace="Sitecore" %>
<script runat="server" language="c#">
// For this administration page to work, IIS needs to be configured to allow Read/Write
// Plugin code
(function (Highcharts) {
Highcharts.wrap(Highcharts.Tooltip.prototype, 'hide', function (proceed) {
var tooltip = this.chart.options.tooltip;
// Run the original proceed method
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
if (!this.isHidden && tooltip.events && tooltip.events.hide) {
;with RootItems as (
select cast(rt.ID as uniqueidentifier) ID, cast(rt.Path as nvarchar(max)) Path
from (select ''n)t
cross apply ( values
('{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}', '/sitecore/content'),
('{B701850A-CB8A-4943-B2BC-DDDB1238C103}', '/sitecore/Forms'),
('{3D6658D8-A0BF-4E75-B3E2-D050FABCF4E1}', '/sitecore/media library'),
('{B26BD035-8D0A-4DF3-8F67-2DE3C7FDD74A}', '/sitecore/templates/Foundation'),
('{8F343079-3CC5-4EF7-BC27-32ADDB46F45E}', '/sitecore/templates/Feature'),
('{825B30B4-B40B-422E-9920-23A1B6BDA89C}', '/sitecore/templates/Project'),