Skip to content

Instantly share code, notes, and snippets.

View blaze182's full-sized avatar
🌊
g'day

Paul Blaze blaze182

🌊
g'day
View GitHub Profile
@blaze182
blaze182 / auth_helpers.rb
Created September 30, 2017 17:39
Request specs devise_token_auth Authentication helpers
# spec/support/requests/auth_helpers.rb
module Requests
module AuthHelpers
module Extensions
def sign_in(user)
let(:auth_helpers_auth_token) {
self.public_send(user).create_new_auth_token
}
end
[alias]
wow = log --all --graph --decorate --oneline --simplify-by-decoration
wip = commit -m 'WIP [ci skip]'
co = checkout
ci = commit
st = status
rebsae = rebase
re = rebase
linereport = ls-files | while read f; do git blame --line-porcelain $f | grep '^author '; done | sort -f | uniq -ic | sort -n
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
@blaze182
blaze182 / transient_enumerable.rb
Last active March 21, 2017 23:04
Rails enum getter for transient attributes
# Rails enum does not decorate transient attribute getters
# This concern aims to set getters if enum for
# transient attribute has been defined.
#
# Also enables question? methods.
#
# Example usage:
# class Model < ActiveRecord::Base
# include TransientEnumerable
#
@blaze182
blaze182 / deploy.rb
Created February 20, 2016 13:57
Capistrano 3 PostgreSQL backup task for Rails
# ...
# config/deploy.rb, config/deploy/production.rb etc.
# contents omitted
###
# example: add backup task prior to deploy
namespace :deploy do
before :deploy, "db:dump"
end