Skip to content

Instantly share code, notes, and snippets.

def authorize!(action, resource)
if ::Ability.new(current_user).cannot?(action, resource)
return_error('permission.not_authorized', 403)
end
end
" Move between panes using ctrl-hjkl
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
return false if invalid_auth?
user.account.authentication_token = AuthToken.generate
user.save
AuthToken.refresh!(user.account)
def refresh!(account)
ActiveRecord::Base.transaction do
do_stuff
account.save
@eidge
eidge / asdjk
Created September 6, 2017 08:57
controllers/admin/users/index -> AdminUsersIndex
controllers/admin/users/edit -> AdminUsersEdit
controllers/admin/device/index
controllers/admin/device/edit
templates/admin/users/index.html
templates/admin/users/edit.html
controllers/welcome
def import_hilton_services
create :category, codename: :personal
path = 'db/seeds/computed_services/hilton_client_status'
ServiceImporter.new(path).import
ServiceSpecificationImporter.new(path).import
ParameterImporter.new(path).import
end
module APIHelper
def api(version = 'v1')
"/api/#{version}"
end
def post(url, *args)
process_request_args(args)
super(url, *args)
end
" Hugo Ribeira
" Vundle {{{
set nocompatible " be iMproved, required
filetype off " required for vundle
set rtp+=~/.nvim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim' " required for vundle to work
[push]
default = current
[color]
ui = auto
[alias]
aa = add --all
ap = add --patch
cm = commit -m
ci = commit -v
co = checkout
Host test-worker
port 22
hostname 192.168.0.131
user deploy
proxycommand ssh deploy@dev-org3-bastion.nourishcare.co.uk -W %h:%p
Host bet
hostname 34.250.62.3
user ubuntu
port 22
Host beta-web
map <leader>vr :set cursorcolumn!<Bar>set cursorline!<CR>