Skip to content

Instantly share code, notes, and snippets.

View fnky's full-sized avatar
⚠️
TypeError: Cannot read property 'status' of undefined.

Christian Petersen fnky

⚠️
TypeError: Cannot read property 'status' of undefined.
View GitHub Profile
@fnky
fnky / promise-serial.js
Last active January 24, 2018 08:22
Promise utilities
import Promise from 'bluebird'
Promise.serial = (input, initialPromise) =>
Promise.reduce(
input,
(previousResult, fn) => fn(previousResult),
initialPromise
);
Promise.prototype.serial = function serial(input) {
@fnky
fnky / flexbox.css
Created April 5, 2018 13:10
Dynamic Vertical Alignment in CSS
/*
Flexbox method
Supported in most browsers, including legacy ones like IE8 and IE9
https://caniuse.com/#feat=flexbox
*/
html, body {
height: 100%;
height: auto;
}
@fnky
fnky / github-markdown.css
Last active September 30, 2018 22:45
Github Markdown for VSCode
/* Generated from 'node_modules/github-markdown-css/github-markdown.css' */
@font-face {
font-family: octicons-link;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s0
@fnky
fnky / Example.tsx
Last active January 31, 2019 10:27
A React Hook to set persisted state, similar to useState
import React from 'react';
import ReactDOM from 'react-dom';
import usePersistedState from './usePersistedState';
function App() {
const [count, setCount, unsetCount] = usePersistedState(
0,
'count',
sessionStorage
);
@fnky
fnky / mark-closed-as-read.js
Created August 26, 2019 07:30
GitHub Snippets
/**
* 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 => {
node.offsetParent.querySelector('button.delete-note').click();
});
@fnky
fnky / emotion.d.ts
Last active September 27, 2019 18:37
Rebass Emotion with Theming support
declare module 'rebass/emotion' {
import * as Rebass from 'rebass';
import { ComponentClass } from 'react';
import { ThemeProviderProps } from 'emotion-theming';
// Styled System Types
export type NumberOrString = Rebass.NumberOrString;
export type Responsive = Rebass.Responsive;
export interface Space extends Rebass.Space {}
@fnky
fnky / BOOKMARK.md
Created August 8, 2015 17:07
My bookmarks in a gist
@fnky
fnky / query-order.graphql
Created October 10, 2019 21:14
GraphQL Patterns
# 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.
"""
@fnky
fnky / serialization-tools.md
Created October 16, 2019 22:23
Binary serialization frameworks, libraries and tools
@fnky
fnky / fonts.md
Created October 18, 2019 11:15
Cheap-ish fonts

Cheap-ish fonts

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