Skip to content

Instantly share code, notes, and snippets.

View esprehn's full-sized avatar

Elliott Sprehn esprehn

View GitHub Profile
<!DOCTYPE html>
<body>
<template id="template">
<style>
:host { color: red; display: block; }
</style>
<div>Example</div>
</template>
<!DOCTYPE html>
<body>
<template id="template">
<style>
:host { color: red; display: block; }
</style>
<div>Example</div>
</template>
Clockwise from the podium:
Peter Linss
Rossen (Microsoft)
tabatkins@
esprehn@
Brad Kemper
kojii@
Andre Ribkey
Elika (fantasai)
@esprehn
esprehn / pseudos.js
Last active September 1, 2016 04:18
Find all the pseudos
(function() {
var selectors = new Map();
for (let sheet of Array.from(document.styleSheets)) {
for (let rule of Array.from(sheet.cssRules || [])) {
var text = rule.selectorText || "";
for (let match of (text.match(/\:([a-zA-Z0-9\-]+)/g) || []))
selectors.set(match, (selectors.get(match) || 0) + 1);
}
}
return [
../../third_party/WebKit/Source/wtf/text/StringConcatenate.h:272:42: error: no matching constructor for initialization of 'StringTypeAdapter<const char *const>'
StringTypeAdapter<const StringType1> adapter1(string1);
^ ~~~~~~~
../../third_party/WebKit/Source/wtf/text/StringOperators.h:40:23: note: in instantiation of function template specialization 'WTF::makeString<const char *, WTF::String>' requested here
return String(makeString(m_string1, m_string2));
^
../../third_party/WebKit/Source/core/clipboard/DataTransferItemList.cpp:82:61: note: in instantiation of member function 'WTF::StringAppend<const char *, const WTF::String>::operator String' requested here
exceptionState.throwDOMException(NotSupportedError, "An item already exists for type '" + type + "'.");
^
../../third_party/WebKit/Source/wtf/text/StringConcatenate.h:47:7: note: candidate constructor (the
@esprehn
esprehn / caret.html
Created March 23, 2017 23:32
Blinking caret that sleeps the main thread for 500ms
<!DOCTYPE html>
<style>
#caret {
height: 16px;
width: 1px;
background: black;
will-change: opacity;
opacity: 1;
transition: opacity;
@esprehn
esprehn / text.js
Created August 30, 2017 01:55
spreading the woes
[...null]
// VM2014:1 Uncaught TypeError: Cannot read property 'Symbol(Symbol.iterator)' of null
// at <anonymous>:1:5
[...undefined]
// VM2026:1 Uncaught TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
// at <anonymous>:1:5
{...undefined}
// {}
<!doctype html>
<script>
function a() {
return new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('test')), 100);
});
}
function b() {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(), 100);