Skip to content

Instantly share code, notes, and snippets.

View tuespetre's full-sized avatar
😶

Derek Gray tuespetre

😶
View GitHub Profile
@tuespetre
tuespetre / template-polyfill.js
Created October 21, 2016 19:19
Allows you to use templates for custom elements in IE11. Wrote this to be able to use webcomponents/shadycss
(function (document) {
if ('content' in document.createElement('template')) {
return;
}
Object.defineProperty(HTMLUnknownElement.prototype, 'content', {
enumerable: false,
configurable: true,
get: function() {
if (this.localName !== 'template') {
@tuespetre
tuespetre / Set-AppPoolEnvVariable.ps1
Last active August 9, 2018 14:32
A PowerShell cmdlet for setting environment variables for AppPoolIdentity users
function global:Set-AppPoolEnvVariable {
param (
[string]$appPool = $(Read-Host "Application Pool"),
[string]$varName = $(Read-Host "Variable name"),
[string]$varValue = $(Read-Host "Variable value")
)
$sec = "System.Security.Principal";
$acct = New-Object "$sec.NTAccount" -ArgumentList "IIS AppPool\$appPool";
$sid = $acct.Translate([System.Type]::GetType("$sec.SecurityIdentifier")).Value;
@tuespetre
tuespetre / parent-node.js
Created October 24, 2016 19:56
A polyfill for the ParentNode interface
(function() {
var polyfill = function(prototype)
{
if (!('firstElementChild' in prototype)) {
Object.defineProperty(prototype, 'firstElementChild', {
get: function() {
var nodes = this.childNodes;
var length = nodes.length;
var current;
for (var i = 0; i < length; i++) {
@tuespetre
tuespetre / example.sql
Last active January 29, 2023 15:20
An attempt at mimicking Postgresql's LISTEN/NOTIFY functionality in SQL Server, using Service Broker
// Worker process:
EXEC [notifications].[Listen] N'something-happened', 5000
// Some other process:
EXEC [notifications].[Notify] N'something-happened'