Skip to content

Instantly share code, notes, and snippets.

Avatar

Vse Mozhe Buty vsemozhetbyt

View GitHub Profile
@vsemozhetbyt
vsemozhetbyt / page-evaluateHandle-example.js
Last active Feb 5, 2020
page.evaluateHandle() example
View page-evaluateHandle-example.js
'use strict';
const puppeteer = require('puppeteer');
(async function main() {
try {
const browser = await puppeteer.launch();
const [page] = await browser.pages();
await page.goto('https://example.org/');
View test-puppeteer.js
'use strict';
const puppeteer = require('puppeteer');
(async function main() {
try {
const browser = await puppeteer.launch();
const [page] = await browser.pages();
await page.goto('https://example.org/');
@vsemozhetbyt
vsemozhetbyt / puppeteer-kbb.js
Last active Mar 22, 2019
puppeteer for kbb.com
View puppeteer-kbb.js
'use strict';
const puppeteer = require('puppeteer');
(async function main() {
try {
const browser = await puppeteer.launch({ headless: false });
const [page] = await browser.pages();
page.setDefaultTimeout(0);
View parse_fmponline.js
'use strict';
const puppeteer = require('puppeteer');
(async function main() {
try {
const browser = await puppeteer.launch();
const [page] = await browser.pages();
await page.goto('https://www.fmponline.com/ecomm/Shop');
View puppeteer-debug-out.txt
puppeteer:session SEND ► {"id":1,"method":"Page.enable","params":{}} +0ms
puppeteer:session ◀ RECV {"id":1,"result":{}} +238ms
puppeteer:session SEND ► {"id":2,"method":"Page.getFrameTree","params":{}} +17ms
puppeteer:session ◀ RECV {"id":2,"result":{"frameTree":{"frame":{"id":"A5576C7526C5BE1FF5DFB821A7BBE9AE","loaderId":"E19A01ABD45F2A56D4B17E78EC01F114","url":"
about:blank","securityOrigin":"://","mimeType":"text/html"}}}} +10ms
puppeteer:session SEND ► {"id":3,"method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":false}} +6ms
puppeteer:session SEND ► {"id":4,"method":"Page.setLifecycleEventsEnabled","params":{"enabled":true}} +2ms
puppeteer:session SEND ► {"id":5,"method":"Network.enable","params":{}} +2ms
puppeteer:session SEND ► {"id":6,"method":"Runtime.enable","params":{}} +2ms
puppeteer:session SEND ► {"id":7,"method":"Security.enable","params":{}} +1ms
View re-unicode-properties.js
'use strict';
const unicodeProperties = {
nonBinaryNames: {
General_Category: [
'Letter',
'Cased_Letter',
'Uppercase_Letter',
'Lowercase_Letter',
'Titlecase_Letter',
View news_bmk_instagram.js
/* ************************************************************************** */
// ==UserScript==
// @name News Bookmark Instagram
// @namespace vsemozhetbyt
// @description News Reading from Bookmark in Instagram
// @version 1
// @include https://www.instagram.com/*
// @noframes
// @grant none
// @nocompat Chrome
View out.txt
[enforcing Ignition and TurboFan for ObjectConstructor because: Super reference
[enforcing Ignition and TurboFan for Uint8ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Int8ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Uint16ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Int16ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Uint32ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Int32ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Float32ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Float64ArrayConstructor because: Super reference
[enforcing Ignition and TurboFan for Uint8ClampedArrayConstructor because: Super reference
@vsemozhetbyt
vsemozhetbyt / flagged-re-tag.js
Created Jul 21, 2017
RegExp tag function with flags
View flagged-re-tag.js
'use strict';
function re(strings, ...expressions) {
const pattern = expressions.reduce(
(acc, expr, i) => `${acc}${expr}${strings[i + 1]}`, strings[0]
);
return ([flags]) => new RegExp(pattern, flags);
}
console.log(re`^abc$``gu`);
View check-mixed-latin-script.js
'use strict';
const fs = require('fs');
const readline = require('readline');
const files = [];
const [, , target = '.'] = process.argv;
if (fs.statSync(target).isDirectory()) {
files.push(...fs.readdirSync(target)
.map(file => `${target}/${file}`)