Skip to content

Instantly share code, notes, and snippets.

View andrewlinfoot's full-sized avatar

Andrew Linfoot andrewlinfoot

View GitHub Profile
@andrewlinfoot
andrewlinfoot / generateResolversFiles.ts
Last active October 13, 2021 21:29
generateResolversFiles.ts
/**
* This script generates server/src/graphql/resolvers.ts file so that we don't
* have to manually maintain an imports file.
*/
import { writeFileSync } from "fs";
import { join } from "path";
import { format } from "prettier";
import getDirectoryFiles from "utils/getDirectoryFiles";
import * as React from "react";
import QueryLoader from "../QueryLoader";
import useGetDataExample from "../../graphql/queries/useGetDataExample";
import useGetOtherDataExample from "../../graphql/queries/useGetOtherDataExample";
const ExampleComponentThatNeedsData = props => {
const dataResult = useGetDataExample();
const otherDataResult = useGetOtherDataExample();
import {
AuthenticationError,
ForbiddenError,
SchemaDirectiveVisitor
} from 'apollo-server-express';
import { defaultFieldResolver } from 'graphql';
import * as jwt from 'jsonwebtoken';
import { JWT_SECRET } from '../../constants';
import { log } from '../../utils';
@andrewlinfoot
andrewlinfoot / xpath.ts
Last active October 21, 2020 14:09
Puppeteer Xpath Utils
const toArray = a => (Array.isArray(a) ? a : [a]);
export async function waitForXpath(page, selector, options = {}) {
return page.waitForFunction(
selector => {
return (
null !==
document.evaluate(
selector,
document,
import React from 'react';
import { shallow } from 'enzyme';
import defer from 'defer-promise';
import Analytics from '../../utils/Analytics';
import Router from '../../utils/Router';
import LoginPage from '../LoginPage';
const defaultProps = {};

Keybase proof

I hereby claim:

  • I am andrewlinfoot on github.
  • I am andrewlinfoot (https://keybase.io/andrewlinfoot) on keybase.
  • I have a public key ASBfQnJyszSuF9-x5GUxJSJMx5v-W2h1SyIf4KxLJUmJYgo

To claim this, I am signing this object: