Skip to content

Instantly share code, notes, and snippets.

TypeError: Cannot read property 'status' of undefined.

Christian Petersen fnky

TypeError: Cannot read property 'status' of undefined.
View GitHub Profile
fnky / BetterFixedLazyExample.jsx
Last active Nov 29, 2019
Lazy conditionals and refs
View BetterFixedLazyExample.jsx
function BetterFixedLazyExample({ lazyValue }) {
// Initialize with null value.
const myRef = useRef(null);
useLayoutEffect(() => {
console.log(myRef.current); // => HTMLDivElement DOM node
}, []);
// Make sure the ref setter is not blocked by conditionals.
return (
fnky / history-with-outer.jsx
Last active Nov 27, 2019
History provider with useState / useRef
View history-with-outer.jsx
import React from 'react';
import { createBrowserHistory } from 'history';
export const historyContext = React.createContext(null);
const HistoryContextProvider = historyContext.Provider;
// This is initialized at the time the file/module is imported, and not on component mount.
const history = createBrowserHistory();
export function History(props) {
fnky /
Created Oct 18, 2019
Cheap-ish fonts

Cheap-ish fonts

A list of cheap-ish fonts, that doesn't put a dent in my wallet.

fnky /
Last active Mar 27, 2021
Awesome Variable Fonts

Awesome Variable Fonts

A list of open source and free* variable fonts.

* Some fonts may require a license to be used for commerical use.

Open Source

fnky /
Created Oct 16, 2019
Binary serialization frameworks, libraries and tools
fnky / stripe-keys-and-ids.tsv
Last active Apr 6, 2021
Stripe keys and IDs
View stripe-keys-and-ids.tsv
Prefix Description Notes
sk_live_ Live secret key Secret key in a live environment.
pk_live_ Live public key Public key in a live environment.
pst_live_ Live Connection token Connection token in a live environment.
sk_test_ Test secret key Pecret key in a test environment.
pk_test_ Test public key Public key in a test environment.
pst_test_ Test Connection token Connection token in a test environment.
ac_ Platform Client ID Identifier for an auth code/client id.
acct_ Account ID Identifier for an Account object.
ch_ Charge ID Identifier for a Charge object.
View query-order.graphql
# Query order pattern from GitHub GraphQL API
# Can be used in conjunction with Relay pagination.
Possible directions in which to order a list of items when provided an `orderBy` argument.
enum OrderDirection {
Specifies an ascending order for a given `orderBy` argument.
View mark-closed-as-read.js
* Marks all closed issues and pull reuqest notifications as read.
(() => {
const closedIssueNodes = document.querySelectorAll('.js-notification .type-icon-state-closed, .js-notification .type-icon-state-merged');
closedIssueNodes.forEach(node => {
fnky / Example.tsx
Last active Jan 31, 2019
A React Hook to set persisted state, similar to useState
View Example.tsx
import React from 'react';
import ReactDOM from 'react-dom';
import usePersistedState from './usePersistedState';
function App() {
const [count, setCount, unsetCount] = usePersistedState(
fnky /
Last active Apr 7, 2021
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1b
  • Decimal: 27