const groupBy = key => array =>
array.reduce((objectsByKeyValue, obj) => {
const value = obj[key];
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
return objectsByKeyValue;
🏴
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colortest() { | |
echo "$(tput setaf 1)1 $(tput setaf 2)2 $(tput setaf 3)3 $(tput setaf 4)4 $(tput setaf 5)5 $(tput setaf 6)6 $(tput setaf 7)7 $(tput setaf 8)8 $(tput setaf 9)9 $(tput setaf 10)10 $(tput setaf 11)11 $(tput setaf 12)12 $(tput setaf 13)13 $(tput setaf 14)14 $(tput setaf 15)15 $(tput setaf 16)16 $(tput sgr0)" | |
local FCR=$(tput setaf 1) | |
local FCG=$(tput setaf 2) | |
local FCY=$(tput setaf 3) | |
local FCB=$(tput setaf 4) | |
local FCM=$(tput setaf 5) | |
local FCC=$(tput setaf 6) | |
local FCW=$(tput setaf 7) | |
local FCK=$(tput setaf 8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const INCREMENT = 'INCREMENT'; | |
const DECREMENT = 'DECREMENT'; | |
const counterReducer = (state = 0, action) => { | |
switch(action.type) { | |
case INCREMENT: | |
return (state += 1); | |
case DECREMENT: | |
return (state -= 1); | |
default: return 0; |