# list docker volumes
docker volume ls -f dangling=true
# rm all docker volumes
docker volume rm $(docker volume ls -qf dangling=true)
# stop all docker containers
docker stop $(docker ps -a -q)
This file contains hidden or 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
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install [email protected] | |
brew unlink [email protected] | |
brew link postgresql |
This file contains hidden or 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
## | |
# .rubocop.yml | |
AllCops: | |
TargetRubyVersion: 2.5 | |
Include: | |
- 'config.ru' | |
- 'Gemfile' | |
- 'Guardfile' | |
- 'Rakefile' |
This file contains hidden or 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
def flatten_array(ary, result = []) | |
raise 'Please pass an array as argument' unless ary.kind_of? Array | |
# if an element in the given array is an array, recursively call flatten_array | |
# on the element, otherwise push it into the result array | |
ary.each do |ele| | |
if ele.class == Array | |
flatten_array(ele, result) | |
else | |
result << ele |
In this example, every time you type something in the input field, the App component updates its state and triggers re-renders of the Count component. Use React memo in React Function Components to prevent a rerender when the incoming props of this component haven't changed:
import React, { useState, memo } from 'react';