Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

David Demonchy fusco

🎯
Focusing
View GitHub Profile
@niinyarko
niinyarko / create_spec.rb
Last active Mar 24, 2020
Request Spec Example for Devise Token Auth Gem with Rails 5.1
View create_spec.rb
# 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 May 22, 2020
Migrating a Rails project from MySQL to PostgreSQL
View README.md

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 May 2, 2020
Upgrade MAMP to Mysql 5.6
View migrate.sh
#!/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 Jan 30, 2019
Google Analytics API (server-to-server) using Ruby
View ruby_google_analytics_server_to_server.md
@devdave
devdave / test3.rb
Created Jul 23, 2012
Working SA auth for Google analytics
View test3.rb
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'
You can’t perform that action at this time.