Skip to content

Instantly share code, notes, and snippets.

View gianlucacandiotti's full-sized avatar

Gianluca Candiotti gianlucacandiotti

  • Wolt
  • Helsinki, Finland
View GitHub Profile
[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)'
@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:
@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 / Start pm2 process
Created August 11, 2017 15:17
Starts pm2 process using specified npm script
pm2 start npm --name "NAME" -- run script-name
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'
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();
@gianlucacandiotti
gianlucacandiotti / after.sh
Last active February 9, 2017 16:26
Vagrant shell provisioning - Mongo DB
#!/bin/bash
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
@gianlucacandiotti
gianlucacandiotti / Rebase Git .dll
Created December 17, 2016 22:51
Git bash will close immediately because of cygwin's heap win32 error.
// From this answer on Stack Overflow
// http://stackoverflow.com/questions/18502999/git-extensions-win32-error-487-couldnt-reserve-space-for-cygwins-heap-win32
C:\Program Files (x86)\Git\bin>rebase.exe -b 0x50000000 msys-1.0.dll
@gianlucacandiotti
gianlucacandiotti / after.sh
Created December 13, 2016 04:51
Vagrant shell provisioning - Yarn
#!/bin/bash
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
@gianlucacandiotti
gianlucacandiotti / after.sh
Created November 10, 2016 14:50
Vagrant shell provisioning - Haskell Minimal Installers
#!/bin/bash
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:hvr/ghc
sudo apt-get update
sudo apt-get install -y cabal-install-1.22 ghc-7.10.3
cat >> ~/.bashrc <<EOF
export PATH="\$HOME/.cabal/bin:/opt/cabal/1.22/bin:/opt/ghc/7.10.3/bin:\$PATH"
EOF
export PATH=~/.cabal/bin:/opt/cabal/1.22/bin:/opt/ghc/7.10.3/bin:$PATH