Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋

Matt Fehskens gonzofish

👋
👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋👋
View GitHub Profile
@gonzofish
gonzofish / esync.js
Created Nov 13, 2019
Just a simple wrapper for async/await that handles errors without a lot try/catch
View esync.js
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 Apr 6, 2018
A webpack watch task through create-react-app & react-app-rewired
View cra-rar-watch.md

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 Apr 29, 2017
Solving FizzBuzz without if in Elixir
View fizz_buzz.exs
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 Dec 15, 2015
This is just an example to show someone how to do a "proper" Y-axis
View index.html
<!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">