Skip to content

Instantly share code, notes, and snippets.

@shkaper
shkaper / btos.js
Created February 6, 2019 14:57
binary to string
function htos(input){var hex=input.match(/[\s\S]{2}/g)||[];var o='';for(var i=0,j=hex.length;i<j;++i){o+='%'+('0'+hex[i]).slice(-2)}return decodeURIComponent(o)}
htos(parseInt(1101000,2).toString(16))
$(".question-wrapper > p").textContent.split(" ").map((b) => htos(b))
@shkaper
shkaper / index.js
Created November 21, 2018 12:42
puppeteer screenshot all DOM nodes
const puppeteer = require('puppeteer')
;(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://youtube.com');
// get a list of all elements - same as document.querySelectorAll('*')
const elements = await page.$$('*')