Skip to content

Instantly share code, notes, and snippets.


Josep M Sobrepere josepot

View GitHub Profile
josepot / .eslintrc.js
Last active Jun 1, 2020
View .eslintrc.js
'use strict';
module.exports = {
root: true,
env: {
browser: false,
commonjs: false,
es6: true,
node: true,
View adventOfCode-2015-day7.js
const {map, pipe} = require('ramda');
const operations = {
NOT: a => ~a,
COPY: a => a,
AND: (a, b) => a & b,
OR: (a, b) => a | b,
LSHIFT: (a, b) => a << b,
RSHIFT: (a, b) => a >> b,
josepot / SagasGlobalErrorHandling.js
Created Dec 3, 2016
Sagas: Global Error Handling
View SagasGlobalErrorHandling.js
// I usually use the request-sequence pattern
// (
// And since 99% of the times that a saga errors it's because something
// went wrong with a request. That's not the only case when a saga can crash.
// The problem is that if there is an unhandled exception is a saga, that
// exception gets propagated all the way up to the rootSaga and the root
// saga will cancell all watchers... Which can be pretty annoying.
// This is one way to avoid such thing from happening:
// This is just a silly example on how to deal with a general exception.
josepot / SagasRequestSequencePattern.js
Last active Dec 4, 2016
Sagas: Request Sequence pattern
View SagasRequestSequencePattern.js
// Request sequence pattern
// One of the reasons why I love Redux-Saga is because it allows me
// to handle all the common requests in a consistent manner,
// which reduces the amount of boilerplate and helps me keep things
// DRYer. I usually use a variation of the following utility Saga
// whenever I have to make a normal/promise request:
import {
You can’t perform that action at this time.