Instantly share code, notes, and snippets.

View gist:a136b2dba649a7c753ae94ddff28912d
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 postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
View git-cheatsheet.md

Retrieve logs in a specific period

git log --since 2017/12/01 --until 2017/12/07 --oneline

# Logs last week in Linux
git log --since  "`date -d '1 week ago' '+%Y/%m/%d'`" --oneline
# Logs last week in OSX
git log --since "`date -v-1w '+%Y/%m/%d'`" --oneline
View arel-cheatsheet.md

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Columns

posts[:id]
posts[:title]
View openssl-gem-install-osx.md

With gem install

$ gem install eventmachine -v '1.0.7' --with-cppflags=-I/usr/local/opt/openssl/include

With bundler:

  • Make sure you have bundle config file ~/.bundle/config
  • Add options when building gem
View motivation-solarized-light.css
/*
* How to change theme:
* Replace the file in .config/chromium/Default/Extensions/[APP_ID]/[APP_VERSION]/css/style.css with this file.
*/
:root {
--base3: #fdf6e3;
--base1: #93a1a1;
--blue: #268bd2;
--green: #859900;