Skip to content

Instantly share code, notes, and snippets.

View bolshakov's full-sized avatar

Tëma Bolshakov bolshakov

  • Spain
View GitHub Profile
@bolshakov
bolshakov / gist:2240761b9280110bb2da
Last active July 3, 2023 14:11
SOLID Code Smells

Single Responsibility

A class should have one, and only one, reason to change.

  • Large Class
    • You can't easily describe what the class does in one sentence.
    • You can't tell what the class does without scrolling.
    • The class needs to change for more than one reason.
    • The class has more than seven methods.
    • The class has a total flog score of 50.
# Project-specific .irbrc
if Dir.pwd != File.expand_path("~")
local_irbrc = File.expand_path '.irbrc'
if File.exist? local_irbrc
puts "Loading #{local_irbrc}"
load local_irbrc
end
end
@bolshakov
bolshakov / Gemfile
Last active December 11, 2015 11:58
source 'https://rubygems.org'
gem 'mechanize'
gem 'ruby-stemmer'
gem 'sequel'
gem 'sqlite3'
gem 'active_support'
gem 'i18n'
gem 'rake'
gem 'hirb-unicode'
@bolshakov
bolshakov / usage.coffee
Created June 7, 2012 20:11
Humaniser usage
# First, we'll need a bunch of helpers -- `m()` for minutes
# and `s()` for seconds:
s = (sec) -> sec * 1000
m = (min) -> min * s(60)
# Humanizer.between(from, to, includeSeconds)
#
# Returns the approximate distance in time between
# two given objects, which can either be `Date` or