Skip to content

Instantly share code, notes, and snippets.

View sadfuzzy's full-sized avatar
🎯
Focusing

Denis Savitskiy sadfuzzy

🎯
Focusing
View GitHub Profile
@sadfuzzy
sadfuzzy / gist:8bb943f74d850e5770f1d1276fd4b01e
Created March 27, 2025 06:12 — forked from kapkaev/gist:4619127
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. Resque
$ redis-cli
> config set stop-writes-on-bgsave-error no
@sadfuzzy
sadfuzzy / delayed_debug.rb
Created April 12, 2024 12:25 — forked from brainopia/delayed_debug.rb
Non blocking delayed debugger for production
module Developer
extend self
delegate :establish_connection, :clear_all_connections!, :to => ActiveRecord::Base
def delayed_debug(scope)
detach_process do
close_io_objects
establish_connection
setup_process_name
notify_developers
@sadfuzzy
sadfuzzy / grades
Created June 19, 2023 21:44 — forked from inem/grades
Грейды в компании занимающейся видеостриммингом
L1
Базовые знание диалекта Typescript, основных встроенных примитивов (Array, Object, Function, String, Date) и методов работы с ними, понимание контекста (this) и способов управления им
Базовые знания фреймворка React
Знание наиболее часто используемых Web API: fetch/XHR, Storage, PostMessage, DOM
Умение писать простейшие алгоритмы (поиск, сортировка, сравнение объектов) без требований к их оптимальности.
Навыки кроссбраузерной адаптивной верстки по макету с использованием существующего кода, знание CSS и препроцессора SCSS
Навыки отладки разметки в браузерах Chrome/Safari
Знание принципов работы HTTP, отличий между различными методами, принципов работы Cookies
Практическое владение лучшими практиками структурирования кода: SOLID/DRY/KISS и т.д.
Базовые знания git, понимание git flow
@sadfuzzy
sadfuzzy / add_countries_gem.sh
Last active May 18, 2023 18:45 — forked from marcomd/rails_migration_create_countries.rb
Rails migration to add countries table and populate it with countries gem
bundler add countries --version "~> 3.0.1" --require false
@sadfuzzy
sadfuzzy / .rubocop.yml
Created March 22, 2017 15:01 — forked from kovalevsky/.rubocop.yml
HttpLab common rubocop config
AllCops:
TargetRubyVersion: 2.3
Exclude:
- 'db/schema.rb'
- 'vendor/**/*'
- 'tmp/**/*'
- 'bin/*'
- 'docs/**/*'
Metrics/LineLength:
@sadfuzzy
sadfuzzy / tmux_cheatsheet.markdown
Last active March 4, 2017 14:52 — forked from kaplan/tmux_cheatsheet.markdown
My most commonly used tmux commands and reference sites for learning tmux

tmux handy commands and references

####sessions

tmux new -s session_name      # new session by name
tmux attach -t session_name     # attach session by name (you can also use a instead of attach)
tmux switch -t session_name     # switch session by name (you can also use a instead of attach)
tmux list-sessions              # list existing sessions
bind-key : new -s session_name  # new session from within a session  
// detach
tmux detach # detach currently attached session
@sadfuzzy
sadfuzzy / routes.rb
Created April 12, 2016 07:30 — forked from kryzhovnik/routes.rb
Интеграция Яндекс.Кассы с Rails
# config/routes.rb
YandexKassaIntegration::Application.routes.draw do
# ...
scope '/yandex_kassa' do
controller 'yandex_kassa', constraints: { subdomain: 'ssl' } do
post :check
post :aviso
get :success
get :fail
class RecountMediamapService
def initialize(task)
@task = task
@comparisons_ids = Film.where.not(kinopoisk_rate: nil).where.not(kinopoisk_rate: 0).where('kinopoisk_num > 10').order(year: :desc, kinopoisk_rate: :desc, kinopoisk_num: :desc).limit(20000).pluck(:id)
@film = Film.includes(:genres, :subgenres, :countries, :tags, :people).find(@task.task.to_i)
end
def recount
begin
kbs = {}
@sadfuzzy
sadfuzzy / hashquiz.rb
Last active August 29, 2015 14:26 — forked from potatosalad/hashquiz.rb
Ruby quiz for convert hash "dot paths" into actual hash hierarchy.
#require 'rubygems'
require 'pp'
#require 'ap' # Awesome Print
class Object
# expects [ [ symbol, *args ], ... ]
def recursive_send(*args)
args.inject(self) { |obj, m| obj.send(m.shift, *m) }
end
end
-- View Current Lock
SELECT c.relname, l.mode, l.granted, l.pid FROM pg_locks as l JOIN pg_class as c on c.oid = l.relation;
-- UTF-8 text search by index
create index on <table> (<column> text_pattern_ops);
-- Generate nodes path
create table <table> as select i, format('/%s/%s/', (random() * 10), (random() * 10)) from generate_series(1,100000);
-- Create extension