Skip to content

Instantly share code, notes, and snippets.

View sebald's full-sized avatar
☀️
^⨀ᴥ⨀^

Sebastian Sebald sebald

☀️
^⨀ᴥ⨀^
View GitHub Profile

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at [email protected] or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@sebald
sebald / a.js
Created November 8, 2017 18:39 — forked from jayphelps/a.js
Making abstractions for redux and redux-observable
// WARNING: Completely untested code. it might not work and/or it might have
// things that don't work well. Just made for illustrational purposes
// redux-observable shines the most with complex async stuff, like WebSockets
// but many of us will still use it for more modest things like AJAX requests.
// In these cases, there can be a ton of repetitive boilerplate. So this is a
// simple example of applying some abstractions and conventions to make it easier.
// THAT SAID, since abstractions cause indirection it can make it harder for
// someone to come along later and know how something works. Weigh the costs
// and remember, this example isn't a suggestion of the actual code you should
@sebald
sebald / emotion-jsxstyle.js
Created November 7, 2017 19:58 — forked from jaredpalmer/emotion-jsxstyle.js
jsxstyle everywhere!
import React from 'react';
import { css as EmotionCSS } from 'react-emotion';
import { jsxstyleFactory } from './jsxstyleFactory';
const cx = (css, styles, className) =>
EmotionCSS([{ ...css, ...styles }, className]);
const jsxstyle = jsxstyleFactory(cx);
export const Box = jsxstyle.Box;
@sebald
sebald / *state-machine-component.md
Created October 26, 2017 10:07 — forked from developit/*state-machine-component.md
265b lib for building pure functional state machine components. https://npm.im/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@sebald
sebald / filterArraysRamda.md
Created September 25, 2017 12:42 — forked from cezarneaga/filterArraysRamda.md
Filter array of objects by nested values using ramda: Sometimes you dont have access to backend and you want to filter the response from an endpoint based on certain criteria. While trivial on flat arrays, this gets a bit tricky if the property you want to query is deeply nested. This is where Ramda shines.

Say we have a prop.users of the shape:

const users = [
    {username: 'bob', age: 30, tags: [{name: 'work', id: 1}, {name: 'boring', id: 2}]},
    {username: 'jim', age: 25, tags: [{name: 'home', id: 3}, {name: 'fun', id: 4}]},
    {username: 'jane', age: 30, tags: [{name: 'vacation', id: 5}, {name: 'fun', id: 4}]}
];
@sebald
sebald / gist:7917136
Last active December 31, 2015 01:49 — forked from dmajda/gist:7688943
Content =
all:(Element / Text)* {
return all.join("").replace(/\n$/, '');
}
Element =
startTag:StartTag content:Content endTag:EndTag {
if (startTag != endTag) {
throw new Error(
"Expected </" + startTag + "> but </" + endTag + "> found."