Skip to content

Instantly share code, notes, and snippets.

View PeterNMcArthur's full-sized avatar

Peter McArthur PeterNMcArthur

View GitHub Profile
@PeterNMcArthur
PeterNMcArthur / useMakeRequest.tsx
Last active December 30, 2021 14:17
A hook to make async requests in react
import { useState } from 'react';
import { AxiosResponse } from "axios";
export type ErrorResponse = {
code: string,
description: string,
}
const defaultError: ErrorResponse = {
code: 'Uknown',
@PeterNMcArthur
PeterNMcArthur / autocurry.js
Last active May 24, 2018 14:12
A function that curries anything you pass in to it
const curry = fn => (...args) => args.length >= fn.length ? fn(...args) : (...nxtArgs) => curry(fn)(...args, ...nxtArgs)
/*!
query-string
Parse and stringify URL query strings
https://github.com/sindresorhus/query-string
by Sindre Sorhus
MIT License
*/
'use strict';
export const queryParse = function (str) {