await
Cypress methods
Don't Given this backend task:
// plugins.ts
const plugin: Cypress.PluginConfig = (on, config) => {
on('task', {
async waitForMe(ms: number) {
return new Promise((resolve) => {
await
Cypress methodsGiven this backend task:
// plugins.ts
const plugin: Cypress.PluginConfig = (on, config) => {
on('task', {
async waitForMe(ms: number) {
return new Promise((resolve) => {
Automatic fix
Open the terminal and set the correct date:
ntpdate -u time.apple.com
/* | |
* Run timers (setInterval/setTimeout) every tick continuously until the promise has been resolved | |
*/ | |
async function runTimersUntilResolved(fn: () => Promise<any>) { | |
jest.useFakeTimers(); | |
let isResolved = false; | |
const p = fn(); | |
p.finally(() => (isResolved = true)); |
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035},{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064}]}'
[user] | |
name = John Doe | |
email = johndoe@gmail.com |
import { useRef } from 'react'; | |
let uniqueId = 0; | |
const getUniqueId = () => uniqueId++; | |
export function useComponentId() { | |
const idRef = useRef(getUniqueId()); | |
return idRef.current; | |
} |
copy( | |
encodeURIComponent(`(function() { | |
function readLocalFile(e) { | |
const file = e.target.files[0]; | |
if (!file) { | |
alert('No file selected!') | |
} | |
const reader = new FileReader(); | |
reader.onload = function(e) { | |
const contents = e.target.result; |
/* | |
The number of changed files (additions/deletions) includes all files. | |
I wanted to see how many files I had changed, excluding tests and test snapshots. | |
This filter will help you do that. | |
To use it, go to the PR, navigate to "Files" and invoke the following | |
*/ | |
(function() { | |
const excludeWords = ['test', 'mock-responses', 'typings']; |
const hypercore = require('hypercore'); | |
const discovery = require('discovery-swarm'); | |
const multifeed = require('multifeed'); | |
const pump = require('pump'); | |
const suffix = process.argv[2]; | |
const db = `./multichat-${suffix}`; | |
console.log(`Using db: ${db}`); | |
const multi = multifeed(hypercore, db, { valueEncoding: 'json' }); |