This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// anywhere | |
import proxyquire from '....../proxyquire.js' | |
// proxyquire.js | |
// use rewiremock to mock proxyquire | |
import rewiremock, { addPlugin, plugins, overrideEntryPoint } from 'rewiremock'; | |
import stackTrace from 'stack-trace'; | |
rewiremock.requireActual('babel-register'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#.... | |
plugins: | |
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs | |
spec: '@yarnpkg/plugin-workspace-tools' | |
- .yarn/plugins/ts-referent-plugin.cjs ### ⬅️ ⬅️ ⬅️ ⬅️ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see cloudflare workers - https://workers.cloudflare.com | |
addEventListener('fetch', event => { | |
event.respondWith(fetchAndStream(event.request)) | |
}) | |
async function fetchAndStream(request) { | |
let streamResponse = fetch(request); // dont await, as majority of CF examples do | |
let { readable, writable } = new TransformStream() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Worker } from "worker_threads"; | |
import type { Compiler, compilation, Plugin } from "webpack"; | |
interface Options { | |
name: string; | |
require?: string[]; | |
keyboard?: boolean; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
padding-right: {ScrollBarWidth}px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from 'react'; | |
type UseResizeObserverCallback = (ref: Element) => void; | |
type ResizeObserverCallback = ( | |
entries: IResizeObserverEntry[], | |
observer: ResizeObserver, | |
) => void; | |
interface IResizeObserverEntry { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
... | |
"plugins": [ | |
"rewiremock/babel", // babel plugin is required to use "Jest-style" mocking | |
] | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { withRouter } from "react-router-dom"; | |
import { getPageScroll, scrollTo } from "./utils"; | |
const ScrollContext = React.createContext(new Map()); | |
const getLocationKey = location => `${location.pathname}?${location.search}`; | |
const ScrollMemory = ({ children, history: _history, location }) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import test from 'ava'; | |
import sinon from 'sinon'; | |
// ^ uses a real FS | |
// nothing before would be mocked | |
import rewiremock from 'rewiremock/node'; | |
import mockfs from 'mock-fs'; | |
import mountfs from 'mountfs'; | |
import fs from 'fs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initial = {}; | |
const fetchMachine = Machine({ | |
id: 'panel', | |
initial: 'waiting', | |
context: initial, | |
states: { | |
waiting: { | |
// always reset to initial context | |
entry: assign(() => null), | |
on: { |
NewerOlder