Skip to content

Instantly share code, notes, and snippets.

Dmytro Rymar drymar

  • Ukraine, Kyiv
Block or report user

Report or block drymar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
drymar /
Created Feb 21, 2018 — forked from MicahElliott/
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.
aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

My largest Sidekiq application had a memory leak and I was able to find and fix it in just few hours spent on analyzing Ruby's heap. In this post I'll show my profiling setup.

As you might know Ruby 2.1 introduced a few great changes to ObjectSpace, so now it's much easier to find a line of code that is allocating too many objects. Here is great post explaining how it's working.

I was too lazy to set up some seeding and run it locally, so I checked that test suite passes when profiling is enabled and pushed debugging to production. Production environment also suited me better since my jobs data can't be fully random generated.

So, in order to profile your worker, add this to your Sidekiq configuration:

RESTORE=$(echo '\033[0m')
BOLD=$(echo '\033[1m')
GREEN=$(echo '\033[1;32m')
echo ${GREEN}
echo "------------------------------"
echo " Installing prerequisites "
echo "------------------------------"
View R.rb
def tickets
when filters.excel
when filters.avia_offset.present? == false
when filters.from_postsale
range_tickets[filters.avia_offset..filters.avia_offset + 9] || []
drymar / migration.rb
Created Apr 11, 2017 — forked from matfiz/migration.rb
Reversible change_column Rails migration
View migration.rb
reversible do |dir|
dir.up { change_column :posts, :name, :text }
dir.down { change_column :posts, :name, :string }
View nokogiri_example.rb
require 'open-uri'
require 'nokogiri'
def words
uri = ''
html = open(uri)
doc = Nokogiri::HTML(html)
germans = doc.css('td.bigLetter')
View links.rb
View example.json
"request": {
"airline": {
"requestedCode": "PS",
"fsCode": "PS"
"flight": {
"requested": "777",
"interpreted": "777"
View contr.rb
class TicketsController < ApplicationController
respond_to? :js
def index
form =
if form.valid?
@ticket = ticket_service(form.pnr_number)
@pnr = form.pnr_number
if @ticket.is_a? String[:error] = @ticket
drymar / savon_client.rb
Created Jul 3, 2016 — forked from hoverlover/savon_client.rb
Using my forks of Akami and Savon to sign a request with a X.509 certificate. See and
View savon_client.rb
client = do
# This can be a URL also
wsdl.document = "/Path/to/your.wsdl"
# These are optional, only if your WSDL sucks :)
wsdl.endpoint = "https://your_endpoint"
wsdl.namespace = "http://your_namespace"
certs = :cert_file => "/path/to/cert.crt", :private_key_file => "/path/to/private/key.pem", :private_key_password => "password"
wsse.sign_with = certs
You can’t perform that action at this time.