Skip to content

Instantly share code, notes, and snippets.

View tuespetre's full-sized avatar
😶

Derek Gray tuespetre

😶
View GitHub Profile
@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'
@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 / 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 / repro.html
Created December 7, 2016 17:56
Repro of a WebKit bug with iOS 10 Safari
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
</head>
<body>
<style>
.hover-me:hover {
color: red;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>inline-or-nah</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>