Navigation Menu

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
#include "angelscript.h"
#include "extdll.h"
#include "util.h"
#include "CASDocumentation.h"
#include "CString.h"
#include "ASEngine.h"
@fnky
fnky / promise-tuple.js
Last active December 18, 2023 19:54
Retrieve tuples from Promise results / async functions
/**
* Returns a Promise which resolves with a value in form of a tuple.
* @param promiseFn A Promise to resolve as a tuple.
* @returns Promise A Promise which resolves to a tuple of [error, ...results]
*/
export function tuple (promise) {
return promise
.then((...results) => [null, ...results])
.catch(error => [error])
}
@fnky
fnky / rust-resources.md
Last active November 7, 2017 08:46
Rust Resources
@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 / color-table.sh
Created October 1, 2018 08:19
Display terminal color table
#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
@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 / hooks.js
Last active January 7, 2024 12:32
React Hooks: useReducer with actions and selectors (Redux-like)
function useSelectors(reducer, mapStateToSelectors) {
const [state] = reducer;
const selectors = useMemo(() => mapStateToSelectors(state), [state]);
return selectors;
}
function useActions(reducer, mapDispatchToActions) {
const [, dispatch] = reducer;
const actions = useMemo(() => mapDispatchToActions(dispatch), [dispatch]);
return actions;
@fnky
fnky / ANSI.md
Last active April 23, 2024 11:55
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

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