Skip to content

Instantly share code, notes, and snippets.

/*
This gist shows a modification of the basic Oauth2 Passport strategy, to be suitable for Slack platform
Module dependencies.
*/
var util = require('util')
var OAuth2Strategy = require('passport-oauth2').Strategy
/**
* `Strategy` constructor.
@mvaragnat
mvaragnat / gist:90de7abb2b9f1f352b6d0819c5283dae
Created September 5, 2017 10:36
Rails : How to compare (diff) to ActiveRecord models
# Hash.diff is deprecated in Rails 5
# this method does not handle deep hashes (it could be made by recursion though)
class MyModel < ApplicationRecord
def diff(contract)
differences = {}
self.attributes.each do |k,v|
if contract[k] != v
differences[k] = {v => contract[k]}
end
Verifying my Blockstack ID is secured with the address 1JRag47EzD413oMdKLNhZWFsdafP5MMKwd https://explorer.blockstack.org/address/1JRag47EzD413oMdKLNhZWFsdafP5MMKwd
@mvaragnat
mvaragnat / gist:b9d0c8c74ca217743e0308e05050c84e
Created March 19, 2019 08:23 — forked from wrburgess/gist:5528649
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production