Skip to content

Instantly share code, notes, and snippets.

View verlihirsh's full-sized avatar
👾

Olga Leonteva verlihirsh

👾
View GitHub Profile
class User < ApplicationRecord
has_many :posts
# Violates Single Responsibility Principle (SRP)
def make_admin
self.update(:is_admin, true)
end
# Violates Law of Demeter (LoD) and N+1 query issue
def recent_posts_with_comments
class Agents < ActiveRecord::Base
has_many :operations
attr_accessor :all_operations_are_success
def operators
self.operations.map { |o| o.operator }
end
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'jlanzarotta/bufexplorer'
Plug 'junegunn/fzf.vim'
Plug 'scrooloose/nerdcommenter'