Skip to content

Instantly share code, notes, and snippets.

View shipiev's full-sized avatar

Roman Shipiev shipiev

View GitHub Profile
@shipiev
shipiev / perfectelementary.bash
Created July 26, 2017 06:59
HowTo Install the perfect Elementary-OS
#Download Elementary OS from here:
#http://sourceforge.net/projects/elementaryos/files/stable/
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
#Install Google Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
@shipiev
shipiev / group_page_numbers.rb
Created October 14, 2016 11:08
Модуль с одной публичной функцией, которая call
module Concerns
module PrintOrder
module GroupPageNumbers
def sequent_grouping(array)
begin_group, prev_value, result = nil, nil, []
array.sort.each_with_index do |item, index|
if index.zero?
begin_group, prev_value = index, item
elsif prev_value.succ != item
@shipiev
shipiev / change_const.rb
Last active September 5, 2016 12:40
Как изменить константу при помощи патча
module VhodWorktypes::ProjectPatch
extend ActiveSupport::Concern
included do
remove_const(:IDENTIFIER_MAX_LENGTH)
end
module ClassMethods
def const_missing(sym)
if sym == :IDENTIFIER_MAX_LENGTH
logins = %i{zabrovskiy lisichkin serkin sokorev romnychev minzhynkov mescheryakova shipiev svyatskaya bykovchenko}
logins.inject do |result, login|
user_id = User.where(login: login).first.id
issues = Issue.where(assigned_to_id: user_id, fixed_version_id: 2279).
spent_full =
issues.joins(:time_entries).where('time_entries.created_on >= DATE("2015-09-15")').
pluck('SUM(time_entries.hours) AS sum_hours').first
est = issues.pluck('SUM(issues.estimated_hours) AS est_hours').first
coef = est.to_f/spent_full.to_f
@shipiev
shipiev / has_policy.rb
Last active September 30, 2015 13:48
has_policy initialization
module HasPolicy
extend ActiveSupport::Concerns
included do
delegate :default_policy, to: :'self.class', allow_nil: true, prefix: false
end
module ClassMethods
def has_policy(policy_name = nil)
@@policy_class =

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP