Skip to content

Instantly share code, notes, and snippets.

View vsemozhetbyt's full-sized avatar

Vse Mozhe Buty vsemozhetbyt

View GitHub Profile
@vsemozhetbyt
vsemozhetbyt / page-evaluateHandle-example.js
Last active February 5, 2020 19:59
page.evaluateHandle() example
'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/');
'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 March 22, 2019 02:16
puppeteer for kbb.com
'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);
'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');
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
@vsemozhetbyt
vsemozhetbyt / re-unicode-properties.js
Created March 5, 2018 02:01
re-unicode-properties.js
'use strict';
const unicodeProperties = {
nonBinaryNames: {
General_Category: [
'Letter',
'Cased_Letter',
'Uppercase_Letter',
'Lowercase_Letter',
'Titlecase_Letter',
/* ************************************************************************** */
// ==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
[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 July 21, 2017 23:51
RegExp tag function with flags
'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`);
'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}`)