Skip to content

Instantly share code, notes, and snippets.

// workaround for https://github.com/cloudflare/workerd/issues/698
const originalFetch = globalThis.fetch;
globalThis.fetch = async function (...args) {
try {
return await originalFetch.apply(this, args);
} catch (e) {
if (!args[1] || typeof args[1] !== 'object') throw e;
const unimplementedCacheError =
e && typeof e === 'object' && 'message' in e && e.message === "The 'cache' field on 'RequestInitializerDict' is not implemented.";
import { useState, useRef, useEffect } from 'react';
export function useDelay(current, delay) {
const [toRender, setToRender] = useState(current);
const queuedTimer = useRef(null);
const latest = useRef(current);
useEffect(() => {
if (latest.current !== current) {
if (!queuedTimer.current) {

Keybase proof

I hereby claim:

  • I am tjenkinson on github.
  • I am tjenkinson (https://keybase.io/tjenkinson) on keybase.
  • I have a public key ASCbXUeQGDhochS6Ixt35sblaoxBxRsf0KhbaG0W2UCvzgo

To claim this, I am signing this object:

// e.g
var monitor = new Monitor(video);
setInterval(function() {
if (monitor.getLevel() < 10) {
console.log("No sound");
}
}, 100);
@tjenkinson
tjenkinson / example.js
Last active April 16, 2020 21:40
Get the base url to a react router route handler.
import React from 'react'
import { Link } from 'react-router'
import getRouteHandlerBaseUrl from 'js/helpers/get-route-handler-base-url'
class Something extends React.Component {
componentWillMount() {
this._baseUrl = getRouteHandlerBaseUrl(this.props)
}
<?php namespace uk\co\la1tv\website\serviceProviders\cosign;
// http://webapps.itcs.umich.edu/cosign/index.php/Cosign_Wiki:CosignFilterSpec
class Cosign {
private $service;
private $filterDbLocation;
private $username = null;
private $ip = null;
private $factors = null;