Skip to content

Instantly share code, notes, and snippets.

What is the difference between Cerebral and Redux?

Cerebral and Redux were built to solve different problems

Redux was developed to achieve hot reloading global state and state changing logic. To achieve that it was necessary for state changes to be run with pure functions and the state has to be immutable. Now you can change the logic inside your reducer and when the application reloads Redux will put it in its initial state and rerun all the actions again, now running with the new state changing logic.

Cerebral had no intention of achieving hot reloading. Cerebral was initially developed to give you insight into how your application changes its state, using a debugger. In the Redux debugger you see what actions are triggered and how your state looks after the action was handled. In Cerebral you see all actions fired as part of a signal. You see asynchronous behaviour, paths taken based on decisions made in your state changing flow. You see all inputs and outputs produced during the flow and you even

@paulirish
paulirish / what-forces-layout.md
Last active December 15, 2025 09:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@cb372
cb372 / jargon.md
Last active August 30, 2025 02:11
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@Rplus
Rplus / example.scss
Created June 20, 2015 20:36
string encode in SASS/SCSS
// source: http://codepen.io/philippkuehn/pen/zGEjxB/?editors=010
$icon-color: #F84830;
// icon styles
// note the fill="' + $icon-color + '"
.icon {
display: inline-block;
@justinwoo
justinwoo / using-rxjs-instead-of-flux-with-react.md
Last active October 21, 2023 10:16
Using RxJS instead of Flux with React to organize data flow

Reposted from Qiita

For almost a year now, I've been using this "flux" architecture to organize my React applications and to work on other people's projects, and its popularity has grown quite a lot, to the point where it shows up on job listings for React and a lot of people get confused about what it is.

Why I'm tired of using and teaching flux

There are a billion explainations on the internet, so I'll skip explaining the parts. Instead, let's cut to the chase -- the main parts I hate about flux are the Dispatcher and the Store's own updating mechanism.

If you use a setup similar to the examples in facebook/flux, and you use flux.Dispatcher, you probably have this kind of flow:

@ericelliott
ericelliott / package.json
Created April 28, 2015 07:37
ES6 npm scripts
"scripts": {
"lint": "eslint source",
"clean": "rm -rf build/* && mkdir build/public && mkdir build/server && mkdir build/client",
"build-server": "babel -d build/server source/server -s",
"build-client": "browserify source/client/index.js -t babelify --outfile build/client/bundle.js",
"build": "npm run clean && npm run build-server && npm build-client"
}
# C-a :source .screenrc
termcapinfo xterm* ti@:te@
term screen-256color
startup_message off
vbell off
autodetach on
altscreen on
shelltitle "$ |bash"
defscrollback 10000
@paulirish
paulirish / bling.js
Last active September 13, 2025 12:13
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
def Group(X, Y):
temp = dict.fromkeys(X, [0, 0])
L = range(len(X))
for i in L:
temp[X[i]][0] += Y[i]
temp[X[i]][1] += 1
return temp
@staltz
staltz / introrx.md
Last active December 1, 2025 11:31
The introduction to Reactive Programming you've been missing