Skip to content

Instantly share code, notes, and snippets.

View olegsobchuk's full-sized avatar
😄

Sobchuk, Oleh olegsobchuk

😄
  • Cherkasy, Ukraine
View GitHub Profile
class Mq::RabbitService
attr_reader :queue_name
def initialize(queue_name)
@queue_name = queue_name
end
def connection
@connection ||= Bunny.new(host: '192.168.1.67', port: 5672, user: 'oleg', password: '111111').start
end
@olegsobchuk
olegsobchuk / encryptable.rb
Created September 2, 2016 11:48
Encrypt Column in Rails
# somewhere in lib or services
module Encryptable
def encrypt_columns(*columns)
columns.each do |column|
if self.column_names.include?("encrypted_#{column}")
self.send(:attr_accessor, column)
define_method "#{column}=" do |value|
self["encrypted_#{column}"] = self.class.verifier.generate(value)
@olegsobchuk
olegsobchuk / gist:c5a5c729dac484e202003bd78e83b6e5
Last active April 13, 2017 12:27
docker_alpine_healthcheck
version: "2.1"
services:
web:
depends_on:
rabbit:
condition: service_healthy
postgres:
condition: service_healthy
redis:
condition: service_started
@olegsobchuk
olegsobchuk / test.rb
Created November 24, 2022 16:59
test task
data = {
'mon_1_open': '09:00',
'mon_1_close': '13:00',
'tue_1_open': '09:00',
'tue_1_close': '13:00',
'wed_1_open': '16:00',
'wed_1_close': '20:00',
'thu_1_open': '09:00',
'thu_1_close': '13:00',
'fri_1_open': '09:00',