This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import puppeteer from "puppeteer-core" | |
const unique = (arr) => [...new Set(arr)] | |
(async () => { | |
const browser = await puppeteer.launch({ | |
headless: true, | |
channel: "chrome", | |
timeout: 60000, | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prefixSelectors(prefix, css) { | |
let insideBlock = false; | |
let look = true; | |
let output = ''; | |
for (let char of css) { | |
if (char === '}') { | |
insideBlock = false; | |
look = true; | |
} else if (char === ',') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const childNodes = (node) => { | |
let frag = document.createDocumentFragment(); | |
while (node.firstChild) { | |
frag.appendChild(node.firstChild); | |
} | |
return frag; | |
}; | |
export default function merge(targetNode, sourceNode) { | |
let namedSlots = sourceNode.querySelectorAll('slot[name]'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { h, Component } from "preact"; | |
import { Router } from "preact-router"; | |
import Header from "./header"; | |
// Code-splitting is automated for routes | |
import Home from "../routes/home"; | |
import Profile from "../routes/profile"; | |
export default class App extends Component { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const idTag = (strings, ...values) => | |
strings.reduce((a, s, i) => a + s + (values[i] || ""), ""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function inView(el, fn) { | |
var location, size; | |
el.getCssValue('display') | |
.then(function (display) { | |
if (display === 'none') { | |
fn(false); | |
} else { | |
return el.getSize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/^<(\w+)((?:\s+(\w|-)+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/ |