Skip to content

Instantly share code, notes, and snippets.

@mizalewski
mizalewski / gist:c7547278e6482e7d7bb24917d224b00c
Created February 21, 2019 21:47 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
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
(function () {
var yMargin = document.querySelector('.navigation-top').getBoundingClientRect().height + 'px';
var xMargin = '0px';
if (window.screen.width < 1150) {
xMargin = '20px';
}
Array.prototype.slice.call(document.querySelectorAll('.blocks-gallery-item img')).forEach(function (image) {
var ratio = image.offsetWidth / image.offsetHeight;
@mizalewski
mizalewski / .rubocop.yml
Last active March 21, 2018 07:33
Opinionated Rubocop configuration
AllCops:
TargetRubyVersion: 2.5 # set your Ruby version
Exclude:
- 'bin/**/*'
- 'tmp/**/*'
- 'vendor/**/*'
- 'db/**/*'
- 'node_modules/**/*'
- '**/config/routes.rb'
client = OAuth2::Client.new Figaro.env.omniauth_google_oauth2_app_id,
Figaro.env.omniauth_google_oauth2_app_secret,
{ site: 'https://accounts.google.com', authorize_url: '/o/oauth2/auth', token_url: '/o/oauth2/token' }
token = client.auth_code.get_token '4/authcode', {}
json = JSON.parse token.get('https://www.googleapis.com/plus/v1/people/me/openIdConnect').body
id = json['sub']
first_name = json['given_name']
last_name = json['family_name']
email = json['email']
email_verified = json['email_verified']