Skip to content

Instantly share code, notes, and snippets.

View chrisfitkin's full-sized avatar

Chris Fitkin chrisfitkin

  • Freelancer
  • Orange County, CA
  • 01:55 (UTC -07:00)
  • LinkedIn in/chrisfitkin
View GitHub Profile
@chrisfitkin
chrisfitkin / ErrorBoundary.tsx
Last active September 12, 2023 01:24
ErrorBoundary component in TypeScript for Next.js 13
"use strict";
import React, { Component, ErrorInfo, ReactNode } from "react";
interface ErrorBoundaryProps {
children: ReactNode;
}
interface ErrorBoundaryState {
hasError: boolean;
}
@chrisfitkin
chrisfitkin / closeVariantScript.js
Last active March 9, 2020 19:06
Close Variant Script
/**
* Converts "exact (close variant)" search queries into negative keywords
*
* @author spencer@klientboost.com
* @version 1.0
*
* -------------------------------- INSTRUCTIONS --------------------------------
*
* 1. Download this script and upload it to your Google Ads account under
* Tools & Settings > Bulk Actions > Scripts
// customQueryStringComponent.js
import React from "react"
import PropTypes from "prop-types"
import withLocation from "./withLocation"
const CustomQueryStringComponent = ({ search }) => {
const { custom } = search
return <p>Custom Value: {custom}</p>
}
// withLocation.js
import React from 'react'
import { Location } from '@reach/router'
import queryString from 'query-string'
const withLocation = ComponentToWrap => props => (
<Location>
{({ location, navigate }) => (
<ComponentToWrap
npm install @reach/router query-string