Skip to content

Instantly share code, notes, and snippets.

Eric Bidelman ebidel

Block or report user

Report or block ebidel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ebidel
ebidel / abort.js
Created Sep 27, 2018
Aborting Promises/fetch
View abort.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Abort promises</title>
</head>
<body>
<button class="download">download</button>
<button class="abort">abort</button>
@ebidel
ebidel / download_chrome41.js
Last active May 6, 2019
For when you need to test your site in Google Search (Chrome 41).
View download_chrome41.js
/**
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ebidel
ebidel / lazyimages_demos_test.js
Last active Oct 1, 2019
Testing lazy loaded image libraries
View lazyimages_demos_test.js
/**
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ebidel
ebidel / reporting_observer.js
Created Jul 19, 2018
Using a ReportingObserver to watch for deprecation warnings on page.
View reporting_observer.js
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*/
// Drop this in the DevTools console:
(new ReportingObserver((reports, observer) => {
console.warn('This page is using deprecated APIs or features:');
const deprecations = reports.map(report => {
@ebidel
ebidel / lighthouse_api_rest_example.js
Last active Jul 19, 2018
Lighthouse API REST example
View lighthouse_api_rest_example.js
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*/
const url = require('url');
const URL = url.URL;
const fetch = require('node-fetch');
const API_KEY = '<YOUR API KEY>';
@ebidel
ebidel / findall_elements_deep.js
Last active Aug 24, 2019
Finds all elements on the page, including those within shadow dom.
View findall_elements_deep.js
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*/
/**
* Finds all elements on the page, inclusive of those within shadow roots.
* @param {string=} selector Simple selector to filter the elements by. e.g. 'a', 'div.main'
* @return {!Array<string>} List of anchor hrefs.
*/
@ebidel
ebidel / coverage.js
Last active Aug 13, 2019
CSS/JS code coverage during lifecycle of page load
View coverage.js
Moved to https://github.com/ebidel/puppeteer-examples
@ebidel
ebidel / index.html
Created Feb 15, 2018
<responsive-element> custom element for enabling container/element queries
View index.html
<!-- based on https://twitter.com/ebidel/status/933496242272747520 -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><responsive-element></title>
<link rel="stylesheet" href="styles.css">
</head>
@ebidel
ebidel / chromelauncher-puppeteer.js
Last active Feb 28, 2018
How to use chrome-launcher to launch chrome, then connect to it using Puppeteer.
View chromelauncher-puppeteer.js
Moved to https://github.com/ebidel/puppeteer-examples/blob/master/lighthouse/chromelauncher_puppeteer.js
@ebidel
ebidel / lighthouse_puppeteer_throttling.js
Last active Feb 28, 2018
Custom network throttling for Lighthouse Testing using Puppeteer
View lighthouse_puppeteer_throttling.js
Now at https://github.com/ebidel/puppeteer-examples/blob/master/lighthouse/throttling.js
You can’t perform that action at this time.