Skip to content

Instantly share code, notes, and snippets.

@jcohenho
jcohenho / 00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Created February 10, 2022 22:58 — forked from stevenharman/00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Heroku Release Phase script for managing Rails DB migrations, and playing nice with Review Apps and postdeploy scripts

Heroku Release Phase + Review Apps + Rails

This is a simplified, but fairly thorough, set of scripts and configuration to enable Heroku Release Phase for Rails apps. Further, this particular set up plays nicely with Heroku Review Apps in that the release phase script will:

  1. Fail, loudly, if the DB does not yet exist.
  2. Load the DB schema if the current schema version (as determined by bin/rails db:version) is 0.
  3. Run DB migrations otherwise.

For a "normal" app that usually means it will run the DB migrations.

Summary

Traveling from the south of Spain to the north of France.

Context

I'm Dani. I live in the south of Spain. I have a budget of 200 €. The north of France is ~2k kms from where I live.

Goal

I want to travel from the south of Spain to the north of France, optimizing time and money. The trip must fit the budget.

Approach

@jcohenho
jcohenho / guide.md
Created January 22, 2020 20:05 — forked from mindlapse/guide.md
A guide on how to use PaymentIntents with tipsi-stripe

Introduction

Card payments with Stripe should be performed with PaymentIntents.

This API was created to handle modern payments, where the cardholder's bank may require the user to authenticate themselves with the bank before a payment can be authorized.

Authentication requirements first started to appear with European banks regulated by PSD2 which introduced [Strong Customer Authentication

Data integrity is so important. We need your help to make sure we've got it.

You've received two different sets of data, each claiming to be the reliable source of truth. Write a ruby command line tool that can parse the two sets of data and output any discrepancies.

The data sits in two CSV files, each with three columns:

Account Email, YouTube Channel, Subscriber Count

You can assume the account emails are the same between files and reliable.

class Product
### attributes: product_name, uid
validates_uniqueness_of :uid
before_save :set_uid
private
class User
attr_accessible :username
has_many :tracks, through: :track_items
end
class TrackItem
attr_accessible :position
belongs_to :user
class Category < ActiveRecord::Base
has_one :blog
end
class Blog < ActiveRecord::Base
belongs_to :category
end
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/jhoffing/.rbenv/versions/1.9.3-p0/bin/ruby extconf.rb
creating Makefile
make
compiling bcrypt_ext.c
In file included from /Users/jhoffing/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby.h:32,
from bcrypt_ext.c:1:
/Users/jhoffing/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby/ruby.h:48:21: error: string.h: No such file or directory
back-end request for retrieving users
##########
def filter
@users = User.where facebook_id: params[:facebook_ids]
respond_with @users
end
front-end request in Coffeescript/Backbone for retrieving the list of FB friends
##########
getListOfFacebookFriends: ->