Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Bower webbower

View GitHub Profile
@webbower
webbower / hooks.js
Created Aug 4, 2020
Useful custom hooks
View hooks.js
const useConstant = value => useState(value)[0];
View rally-btree-serialize-post-interview.js
//// POST INTERVIEW VERSION
// NOTE Rado, Yi: I took the code where I left off and got it working in this second Gist file. It's probably not
// the most elegant solution, but it works. The code as of the end of the interview is in the other Gist.
// Given a binary tree, how would you serialize it into a string?
//Example input
var input = {
value: "a",
left: {
@webbower
webbower / interview.css
Last active Jul 7, 2020
Interviewing utilities
View interview.css
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
@webbower
webbower / ducks-module-tmpl.js
Last active May 4, 2020
Template for a Redux Ducks module
View ducks-module-tmpl.js
const prop = key => obj => obj[key];
// Action Types
const MY_ACTION = '{my}-app/{module}/MY_ACTION';
// Action Creators
export const myAction = (value) => ({
type: MY_ACTION,
payload: value,
});
View a11y.html
<html lang="en">
<head>
<meta charset="UTF-8">
<title>a11y for HTML</title>
<style>
/**
* Visually hide an element, but leave it available for screen readers
* @link https://github.com/h5bp/html5-boilerplate/blob/master/dist/css/main.css
* @link http://snook.ca/archives/html_and_css/hiding-content-for-accessibility
@webbower
webbower / package.json
Last active May 1, 2020
Simple, composable, instanced-enabled model factories
View package.json
{
"name": "simple-model",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {},
"scripts": {
"start": "watch 'yarn run test' src",
"test": "tape -r esm src/*.test.js"
},
@webbower
webbower / extract-error-data.js
Created Nov 9, 2019
Extract data from error objects for serialization since Error instances are weirdly finicky and not straightforward to pull data from
View extract-error-data.js
const builtInErrorTypes = [
Error,
EvalError,
RangeError,
ReferenceError,
SyntaxError,
TypeError,
URIError,
];
@webbower
webbower / asciimoji.txt
Last active Aug 9, 2019
ASCII Emoji Reference
View asciimoji.txt
Shrug ¯\_(ツ)_/¯
Googley shrug ¯\(º_o)/¯
Flip all tables ┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻
Reset table ┬─┬ ノ( ゜-゜ノ)
Cthulhu /|\(;,;)/|\
@webbower
webbower / line.sh
Created Feb 5, 2019
Bash command to get a line from a file
View line.sh
# https://stackoverflow.com/a/6022431/2684520
function line() {
sed "${1}q;d" "$2"
}
@webbower
webbower / include-once.scss
Created Dec 19, 2018 — forked from StefanoRausch/include-once.scss
Import Once Feature Implemented in Sass.
View include-once.scss
$is-included : () !default;
@mixin once( $name ) {
@if include-once( $name ) {
@content;
}
}
@function include-once( $name ) {
@if index( $is-included, $name ) {
You can’t perform that action at this time.