Skip to content

Instantly share code, notes, and snippets.

@kaiskye
kaiskye / screeps_generate_body.js
Last active Sep 8, 2020
Helper function for Screeps for generating creep body parts based on a regex-like pattern
View screeps_generate_body.js
/**
* Generates a list of body parts to spawn a creep with by following a
* regex-like pattern to decide which parts to try spawning and fitting in as
* many parts as possible for the given amount of energy.
*
* Pattern examples:
*
* 'mah' 1 MOVE, 1 ATTACK, and 1 HEAL part
* 'mw4a' 1 MOVE part, 4 WORK parts, and 1 ATTACK part
* 'm*' As many MOVE parts as will fit
@ArcanisCz
ArcanisCz / createProvider.js
Last active Jun 22, 2020
React Error Boundary, which can catch Component + Redux + Saga errors
View createProvider.js
/*
* Usage:
* const AppProvider = createProvider(rootReducer, rootSaga);
* ...
* <AppProvider>
* <AppComponent>
* </AppProvider>
*/
const createProvider = (reducer, saga) => {
const sagaMiddleware = createSagaMiddleware();
You can’t perform that action at this time.