Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@blois
blois / es6module.js
Last active November 20, 2019 20:54
import * as test from 'https://www.npmjs.com/package/test'
export function renderMime({node, data}) {
const widget = test.render(node, data);
return {
onData(newData) {
widget.update(newData);
},
onCleanup() {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Plot lines and/or markers to the
:class:`~matplotlib.axes.Axes`. *args* is a variable length
argument, allowing for multiple *x*, *y* pairs with an
optional format string. For example, each of the following is
legal::
plot(x, y) # plot x and y using default line style and color
plot(x, y, 'bo') # plot x and y using blue circle markers
plot(y) # plot y using x as index array 0..N-1
plot(y, 'r+') # ditto, but with red plusses
const puppeteer = require('puppeteer');
async function waitForElement(page, selector) {
while (true) {
const element = await page.$(selector);
if (element) {
return element;
}
await new Promise((resolve) => setTimeout(resolve, 100));
}
@blois
blois / gist:8926615
Created February 10, 2014 23:49
Document.currentScript workaround
function getCurrentScript(callback) {
if (document.currentScript) {
callback(document.currentScript);
return;
}
var scripts = document.scripts;
function onLoad() {
for (var i = 0; i < scripts.length; ++i) {
scripts[i].removeEventListener('load', onLoad, false);
}