Skip to content

Instantly share code, notes, and snippets.

View igorkasyanchuk's full-sized avatar

Igor Kasyanchuk igorkasyanchuk

View GitHub Profile

General

Startups

  • Twitter
  • Shopify
  • Github
  • Basecamp
  • Ask.fm
  • Groupon
gparted
merge & resize
sudo lvextend -r -l+100%FREE /dev/mapper/ubutnu-vg-root
sudo resize2fs /dev/mapper/ubutnu-vg-root
du -h . -d 1 | sort -nr
@igorkasyanchuk
igorkasyanchuk / gist:ba35578b01f1d6f7763fdd9f3eb25cd9
Last active November 7, 2019 06:47 — forked from evtuhovich/gist:1134998
Список вопросов для собеседования
ООП
що таке SOLID
розкажи про якийсь з цих принципів
3 принципа ООП
Ruby
принципиальное различие скриптовых и “обычных” языков
реализация множественного наследования в ruby (модулі)
duck typing
многопоточность в ruby
метапрограмінг в рубі
require 'rubygems'
require 'pry'
class Hooks
def initialize; @callbacks ||= Hash.new({before: [], after: []}) end
def to_s; @callbacks.inspect; end
def register_hook(type, method_name, callback_method = nil, &block)
@callbacks[method_name][type].push(callback_method || block)
end
@igorkasyanchuk
igorkasyanchuk / gist:615f22516e2a4de359eda7a1135df0b4
Last active March 13, 2022 10:33
diff using paper trail and diff gem
Gemfile
gem 'paper_trail'
gem 'diffy'
gem 'activerecord-diff'
# view
= title "Logs"
## ----
settings = DashboardSettings.new(user: current_user)
card = settings.card(params[:id])
json: card.to_json
component = DashboardComponent.new(user: current_user) # inside DashboardSettings
json: component.to_json
## ----
[
{
"_id": "58aee4d83f465d9753258fca",
"index": 0,
"guid": "8e2d4217-292e-4dea-80a7-36bedf426424",
"isActive": true,
"balance": "$2,305.20",
"picture": "http://placehold.it/32x32",
"age": 36,
"eyeColor": "green",
[
{
"_id": "58aee4d83f465d9753258fca",
"index": 0,
"guid": "8e2d4217-292e-4dea-80a7-36bedf426424",
"isActive": true,
"balance": "$2,305.20",
"picture": "http://placehold.it/32x32",
"age": 36,
"eyeColor": "green",