Skip to content

Instantly share code, notes, and snippets.

@valmassoi
valmassoi / chain.js
Created January 7, 2020 20:39
chain functions like jQuery
const chain = {
first: () => {
console.log(1);
return chain;
},
third: function() { // cant use fat arrow, binds this
console.log(3);
return this;
},
second: () => {
@valmassoi
valmassoi / getState.rule.json
Created January 15, 2020 14:26
eslint disallow getState
"no-restricted-syntax": [
"error",
{
"selector": "CallExpression[callee.name='getState']",
"message": "Actions must be kept pure. Pass in the needed piece of state as a param."
}
]
@valmassoi
valmassoi / createStore.js
Created January 7, 2020 15:34
redux createStore from scratch
// https://egghead.io/lessons/react-redux-implementing-store-from-scratch
const createStore = (reducer) => {
let state;
let listeners = [];
const getState = () => state;
const dispatch = (action) => {
// calculate new state

Keybase proof

I hereby claim:

  • I am valmassoi on github.
  • I am valmassoi (https://keybase.io/valmassoi) on keybase.
  • I have a public key ASCTZ4fnmhX2myb0nKI1oYUVO_fcS4XgWmBUKV-oHdOVeAo

To claim this, I am signing this object:

Verifying that +valmassoi is my blockchain ID. https://onename.com/valmassoi