Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fusco's full-sized avatar
🎯
Focusing

David Demonchy fusco

🎯
Focusing
View GitHub Profile
@niinyarko
niinyarko / create_spec.rb
Last active November 16, 2021 19:03
Request Spec Example for Devise Token Auth Gem with Rails 5.1
# Example Request
# My Devise model is named Merchant
# Key lines to note are 16, 21, 27, 28, 29
require 'rails_helper'
RSpec.describe 'POST /api/v2/customer_groups', type: :request do
let(:merchant) { FactoryGirl.create(:merchant) }
let(:user) { FactoryGirl.create(:user) }
let(:customer) { merchant.customers.create(user_id: user.id)}
let(:params) {{
@tristanm
tristanm / README.md
Last active March 10, 2024 20:11
Migrating a Rails project from MySQL to PostgreSQL

Migrating a Rails project from MySQL to PostgreSQL

This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.

No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!

I chose [pgloader][1] because it's extremely fast. YMMV.

  1. Replace mysql2 gem with pg in Gemfile.
  2. Update config/database.yml for PostgreSQL. I used [Rails' template][2] as a starting point.
@tobi-pb
tobi-pb / migrate.sh
Last active March 3, 2023 23:34
Upgrade MAMP to Mysql 5.6
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24-osx10.9-x86_64.tar.gz
tar xfvz mysql-5.6*
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
@joost
joost / ruby_google_analytics_server_to_server.md
Last active November 27, 2023 15:43
Google Analytics API (server-to-server) using Ruby
@devdave
devdave / test3.rb
Created July 23, 2012 22:21
Working SA auth for Google analytics
require 'pry'
require 'rubygems'
require 'google/api_client'
passPhrase = "notasecret"
keyFile = "YOUR KEY HERE-privatekey.p12"
cID = "YOUR ID HERE.apps.googleusercontent.com"
scope = 'https://www.googleapis.com/auth/analytics.readonly'
profileID = "YOUR PROFILE ID"
email = 'YOUR_SA_ACCOUNT_EMAIL_HERE@developer.gserviceaccount.com'