Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env node
import { chromium } from "playwright";
import { readFileSync } from "node:fs";
import { once } from "node:events";
async function main() {
const browser = await chromium.launch({ headless: false });
try {
const cookies = await readCookies("cookies.json");
@victorporof
victorporof / async-stack-tagging-recurring.js
Last active May 30, 2022 06:25
Async Stack Tagging API (Recurring)
/* --- Userland --- */
function makeUpdate(i) {
return function someUpdate() {
console.trace(`completeUpdate: update ${i}`);
};
}
function businessLogic() {
scheduler.scheduleTask("foo", [makeUpdate(1), makeUpdate(2), makeUpdate(3)]);
@victorporof
victorporof / async-stack-tagging-non-recurring.js
Last active May 30, 2022 06:25
Async Stack Tagging API (Non-Recurring)
/* --- Userland --- */
function someTask() {
console.trace("completeWork: someTask");
}
function someOtherTask() {
console.trace("completeWork: someOtherTask");
}
@krisselden
krisselden / profile.js
Created February 19, 2021 01:09
Profile node with child processes
/* eslint-env node */
const { Session } = require('inspector');
const fs = require('fs');
const captureExit = require('capture-exit');
captureExit.captureExit();
/** @param exitPromise {Promise<void>} */
async function runProfile(exitPromise) {
function createQueue() {
let queue = [];
let i = 0;
let len = 0;
return [
(fn) => (queue[len++] = fn),
() => {
try {
for (; i < len; i++) {
const fn = queue[i];
var assert = require('assert');
global.KEYS = JSON.parse(require('fs').readFileSync('bindings.json','utf8'));
global.RESULT = false;
global.CHARAT = function (key) {
var l = key.length;
return l > 7 &&
key.charAt(l - 7) === 'B' &&
key.charAt(l - 6) === 'i' &&
key.charAt(l - 5) === 'n' &&
@krisselden
krisselden / README.md
Last active July 5, 2016 09:07
# Plot and Test Samples in R
@rwjblue
rwjblue / 01_README.md
Last active December 1, 2015 15:57
Canary Base
import Ember from 'ember';
import { module } from 'qunit';
import startApp from 'livin/tests/helpers/start-app';
import OnboardPage from 'livin/tests/helpers/page-objects/onboard';
import { test } from 'qunit';
const { run } = Ember;
let application;
module('Acceptance | onboard', {
@lukemelia
lukemelia / note.txt
Created April 8, 2015 04:34
When Error: watch EMFILE strikes (OS X)
This requires `brew install jq` which is a command json query.
I got this from @krisselden