This file contains 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
/** | |
* Implementation example of writable response bodies. | |
* Based on the draft of the Streams API (19 March 2014) | |
* https://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm | |
* Design document for response body reading/writing: | |
* https://docs.google.com/document/d/1iE6M-YSmPtMOsec7pR-ILWveQie8JQQXTm15JKEcUT8 | |
*/ | |
/* globals chrome, ByteStream, URL, XMLHttpRequest */ | |
'use strict'; |
This file contains 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
/* Example: | |
var someUnsafeStr = '<img>'; | |
var result = escapeHTMLTag`<input value="${someUnsafeStr}">`; | |
console.log(result); // <input value="<img>"> | |
// Questions? rob {at} robwu.nl | |
// */ | |
function escapeHTML(str) { | |
// Note: string cast using String; may throw if `str` is non-serializable, e.g. a Symbol. |
This file contains 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
var items = Array.prototype.slice.call( | |
document.querySelectorAll('*') | |
).map(function(element) { | |
var listeners = getEventListeners(element); | |
return { | |
element: element, | |
listeners: Object.keys(listeners).map(function(k) { | |
return { event: k, listeners: listeners[k] }; | |
}) | |
}; |
This file contains 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 puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch({headless: false}); | |
const page = await browser.newPage(); | |
await page.setContent('<iframe></iframe>'); | |
// the page.frames()[0] is always a main frame. | |
const iframe = page.frames()[1]; | |
// fetch the body element of the iframe |
This file contains 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
/** | |
* Waits for an element satisfying selector to exist, then resolves promise with the element. | |
* Useful for resolving race conditions. | |
* | |
* @param selector | |
* @returns {Promise} | |
*/ | |
export function elementReady(selector) { | |
return new Promise((resolve, reject) => { | |
let el = document.querySelector(selector); |
This file contains 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 CDP = require('chrome-remote-interface'); | |
CDP(async (client) => { | |
const {Network, Page, Target} = client; | |
Network.requestWillBeSent(({request, redirectResponse}) => { | |
console.log((redirectResponse || {}).url + ' -> ' + request.url); | |
}); | |
Target.targetCreated((params) => { | |
if(params.targetInfo.type != "page") { |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Mutation Observers</title> | |
<meta name="viewport" content="width=device-width"> | |
<link rel="stylesheet" href="../video-pages/main.css"> | |
</head> | |
<body> | |
<header> |
This file contains 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
Open apache httpd.conf file | |
Enable the following Modules by removing the # at the front of the line. | |
- LoadModule rewrite_module modules/mod_rewrite.so | |
- LoadModule proxy_module modules/mod_proxy.so | |
- LoadModule proxy_http_module modules/mod_proxy_http.so | |
- LoadModule proxy_connect_module modules/mod_proxy_connect.so | |
Open apache httpd-vhosts.conf | |
<VirtualHost *:80> | |
ProxyRequests On |
OlderNewer