Skip to content

Instantly share code, notes, and snippets.

View gonzofish's full-sized avatar
👋
👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋

Matt Fehskens gonzofish

👋
👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋
View GitHub Profile
@gonzofish
gonzofish / esync.js
Created November 13, 2019 13:52
Just a simple wrapper for async/await that handles errors without a lot try/catch
const identity = (value) => value;
const esync = (promise, formatResult = identity) => (
promise.then(async (result) => [undefined, await formatResult(result)])
.catch((error) => [error])
);
export default esync;
@gonzofish
gonzofish / cra-rar-watch.md
Last active April 6, 2018 18:44
A webpack watch task through create-react-app & react-app-rewired

The below code will run a Webpack watch while leveraging create-react-app and react-app-rewired. The code is primarily based off of this gist but modified to work with react-app-rewired. Some of the comments on the original gist helped make this work.

Having a watch task like this is useful when you need to use your create-react-app-scaffolded code run through another server and not the Webpack dev server.

Usage

@gonzofish
gonzofish / fizz_buzz.exs
Created April 29, 2017 12:56
Solving FizzBuzz without if in Elixir
fizz_word = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, third) -> third
end
fizz_buzz = fn n -> fizz_word.(rem(n, 3), rem(n, 5), n) end
@gonzofish
gonzofish / index.html
Last active December 15, 2015 04:19
This is just an example to show someone how to do a "proper" Y-axis
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Negative Y-Axis Example</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<script type="text/javascript">