Skip to content

Instantly share code, notes, and snippets.

Every day!

Sergii Demianchuk ndemianc

Every day!
Block or report user

Report or block ndemianc

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
ndemianc / ruby_prof_sidekiq.rb
Created Jun 29, 2018
How to use Ruby Prof to profile Sidekiq Worker
View ruby_prof_sidekiq.rb
# How to use Ruby Prof to profile Sidekiq Worker
require 'ruby-prof'
result = RubyProf.profile do
#Code to analyse in a method
ndemianc / dig_vs_fetch.rb
Last active Jun 25, 2018
Hash#dig vs Hash#fetch
View dig_vs_fetch.rb
require "benchmark"
h = { a: { b: { c: { d: { e: "foo" } } } } }
n = 50_000
Benchmark.bmbm(7) do |x| "Hash#dig" do
n.times do ; h.dig(:a, :b, :c, :d, :e); end

Keybase proof

I hereby claim:

  • I am ndemianc on github.
  • I am ndemianc ( on keybase.
  • I have a public key ASBLihFG_HQlBwIv69F1pQ3HTr3VgnpAtkSuCboGTeAARQo

To claim this, I am signing this object:

ndemianc /
Last active Mar 12, 2018
Docker: stop and remove all docker containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
ndemianc / benchmark.rb
Last active Dec 14, 2017
Benchmark Array#to_h and Enumerable#inject
View benchmark.rb
require 'benchmark'
array =, { id: 'key' })
values = ['.p12', '.pfx']
Benchmark.bmbm(7) do |bm|'to_h') do do |prop|
import redis
r = redis.StrictRedis(host='localhost', port=6379, decode_responses=True, password='123')
r.hset('candidate:1', 'name', 'Mary Sue')
r.hset('candidate:1', 'position', 'super tester')
r.hget('candidate:1', 'name')
m = r.hgetall('candidate:1')
ndemianc / process.ex
Last active Jan 5, 2017
Small linked task, that can run on the multicore processor, and save a state inside Map like key-value store in Elixir
View process.ex
defmodule Project do
@moduledoc """
This module includes example code of the Elixir linked tasks based on the Elixir linked processes.
@doc """
Create new task.
Returns `{:ok, pid}`
You can’t perform that action at this time.