Skip to content

Instantly share code, notes, and snippets.

View Warsaalk's full-sized avatar

Klaas Van Parys Warsaalk

View GitHub Profile
@Warsaalk
Warsaalk / parseHTMLtoDOM.js
Last active September 7, 2016 08:04
Parse HTML to DOM
function parseHTMLtoDOM (html) {
var regexTags = /(<[a-zA-Z1-9]+(?:\s+[a-zA-Z-]+(?:=(?:".*?"|'.*?'))?)*\s*\/?>|<\/[a-zA-Z1-9]+>)/gm, // Match tags (opening incl. attributes & closing)
regexAttr = /(?:\s+([a-zA-Z-]+)(?:=(?:"(.*?)"|'(.*?)'))?)/gm; // Match attributes
var singletons = ['area','base','br','col','command','embed','hr','img','input','keygen','link','meta','param','source','track','wbr']; // HTML 5 - 6/9/2016
html = html.replace(/&nbsp;/g, '\u00A0'); // TODO: add more encoding fixes
var parts = html.split(regexTags), fragment = document.createDocumentFragment(), lastElement = fragment;
for (var i=0, il=parts.length; i<il; i++) {
@Warsaalk
Warsaalk / outlook-signature-update.vbs
Last active February 4, 2021 00:07
Outlook signature distribution logon script - Template
' Global variables
Set objShell = CreateObject("WScript.Shell")
Set objUser = CreateObject("ADSystemInfo")
Set objCurrentUser = GetObject("LDAP://" & objUser.UserName)
' Outlook signature location, for Outlook 2010, 2013 & 2016
appData = objShell.ExpandEnvironmentStrings("%APPDATA%")
outlookSignatures = appData & "\Microsoft\Signatures"
' Signature locations
@Warsaalk
Warsaalk / mutationlistener-test.html
Last active February 5, 2024 08:34
A Javascript class that observes DOM changes for a single target. It allows listening to ID's, Classes and Node names and returns the nodes if they are added to the DOM.
<!doctype html>
<html>
<head>
<title>Mutation Listener</title>
<script src="mutationlistener.js"></script>
</head>
<body>
<div id="test">
Existing content
</div>