Skip to content

Instantly share code, notes, and snippets.

View hmatringe's full-sized avatar

Hadrien Matringe hmatringe

View GitHub Profile

Fixing Webpacker 3.3.0 + Rails 5.1.5

Heroku hosting trouble

Heroku may not detect a correct buildpack for your JS dependencies, then you have to set it manually:

heroku buildpacks:add heroku/nodejs -i 1
heroku buildpacks:add --index 2 https://github.com/heroku/heroku-buildpack-ruby
@peterclark
peterclark / ruby-google-api-analyticsv3.rb
Last active May 1, 2020 02:19
Authentication with the Ruby Google API Client and Google Analytics API
# Create credentials json file
# 1. Go to Google API Console
# 2. Create credentials (Service Account Key). Note 'Service account ID'
# 3. Download key as 'google_auth.json'
# 4. Go to Google Analytics -> Admin -> View Settings. Note 'View ID'
# 5. Go to User Management -> Add permissions for: (Service account ID) [Read & Analyze]
# Terminal
export GOOGLE_APPLICATION_CREDENTIALS='config/google_auth.json'
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active January 29, 2024 10:09
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

@olivierlacan
olivierlacan / migrate_postgresql_database.md
Last active March 24, 2022 20:30
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide: http://olivierlacan.com/posts/migrating-homebrew-postgres-to-a-new-version/

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

@szydan
szydan / gist:b225749445b3602083ed
Last active February 5, 2024 15:16
<U+FEFF> character showing up in files. How to remove them?
1) In your terminal, open the file using vim:
vim file_name
2) Remove all BOM characters:
:set nobomb
3) Save the file:
:wq
@thechrisoshow
thechrisoshow / whitelabeling.rb
Created August 16, 2011 10:43
How should I white label a Rails app?
class ApplicationController < ActionController::Base
around_filter :set_white_label
private
def set_white_label
subdomains = request.subdomains - RESERVED_SUBDOMAINS
if subdomains.empty?
yield
return
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')