Skip to content

Instantly share code, notes, and snippets.

View gianlucacandiotti's full-sized avatar

Gianluca Candiotti gianlucacandiotti

  • Wolt
  • Helsinki, Finland
View GitHub Profile
import { createLogger } from 'redux-logger';
const logger = createLogger({
stateTransformer: (state) => {
const newState = {};
const stateObj = state.toObject();
for (const i of Object.keys(stateObj)) {
if (Iterable.isIterable(stateObj[i])) {
newState[i] = stateObj[i].toJS();
const OMDB_ENDPOINT = 'http://www.omdbapi.com';
class OMDbService {
async searchMovies(searchValue) {
const url = `${OMDB_ENDPOINT}/?s=${searchValue}`;
const response = await fetch(url, {
method: 'GET',
headers: {
Accept: 'application/json'
@gianlucacandiotti
gianlucacandiotti / Start pm2 process
Created August 11, 2017 15:17
Starts pm2 process using specified npm script
pm2 start npm --name "NAME" -- run script-name
@gianlucacandiotti
gianlucacandiotti / dynamicImports.js
Last active February 20, 2018 18:05
Dynamic imports with Webpack.
import flow from 'lodash/fp/flow';
import filter from 'lodash/fp/filter';
import reduce from 'lodash/fp/reduce';
const filesPaths = require.context('.', true, /.js$/);
const files = flow(
filter(page => page !== './index.js'),
reduce((acc, page) => {
const [
@gianlucacandiotti
gianlucacandiotti / withAttachedProps.jsx
Last active May 26, 2018 16:36
Higher Order Function that returns a HOC to attach Components as static props based on a set of values.
import React, { PureComponent } from 'react';
import values from 'lodash/fp/values';
import flow from 'lodash/fp/flow';
import forEach from 'lodash/fp/forEach';
import getDisplayName from '@/utils/getDisplayName';
/**
* Higher Order Function that returns a HOC to attach Components as static props based on a
* set of values.
* It allows you to go from:
[alias]
lg = lg1
lg1 = lg1-specific --all
lg2 = lg2-specific --all
lg3 = lg3-specific --all
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'