Skip to content

Instantly share code, notes, and snippets.

driv3r / kv.exs
Created Mar 11, 2019
Going functional with elixir & otp
View kv.exs
defmodule KV do
@moduledoc """
Key value store.
## Examples
Basic usage
iex> {:ok, pid} = KV.start_link()
iex> KV.put(pid, "foo", :bar)
driv3r /
Last active Jun 26, 2018
Elixir design and testing patterns


Application consist of 3 servers:

  • Queue, for fetching/deleting messages from the queue
  • Token, for fetching access token required for other service
  • Cron, for republishing messages from queue to 3rd party service by using access token authentication

Each of the HTTPoison calls are supposed to be replaced by proper Endpoints which could have used @behaviour and have an Http implementation, that could be set via application configuration and tested with mox.

driv3r / stack_trace
Created Sep 17, 2013
rbx failure when running `defined?(__ENCODING__)`
View stack_trace
An exception occurred running /home/travis/.rvm/gems/rubinius-2.0.0-weekly20130906-d19@global/gems/rake-10.1.0/lib/rake/rake_test_loader.rb
/home/travis/build/driv3r/simple-rss/lib/simple-rss/parser.rb:3: defined? passed an unrecognized expression (Exception)
 Rubinius.unrecognized_defined at kernel/delta/rubinius.rb:242
Object#__script__ at lib/simple-rss/parser.rb:3
 Rubinius::CodeLoader.require at kernel/common/codeloader.rb:232
 Kernel(Object)#require at kernel/common/kernel.rb:635
Object#__script__ at lib/simple-rss.rb:5
 Rubinius::CodeLoader.require at kernel/common/codeloader.rb:232
driv3r / ruby-build.20130808125730.21992.log
Created Aug 8, 2013
Crash while trying to run `rbenv install rbx-2.0.0-dev` inside chef recipe. It waits for user input `y` for gems like rake, rdoc, ri and others which are in preinstall-gems.
View ruby-build.20130808125730.21992.log
/tmp/ruby-build.20130808125730.21992/rubinius-2.0.0-dev/staging/bin/rbx /tmp/ruby-build.20130808125730.21992/rubinius-2.0.0-dev/rakelib/preinstall_gems.rb
Pre-installing gems for 1.9.3...
An exception occurred running /tmp/ruby-build.20130808125730.21992/rubinius-2.0.0-dev/rakelib/preinstall_gems.rb
"rake" from rake conflicts with /tmp/ruby-build.20130808125730.21992/rubinius-2.0.0-dev/staging/bin/rake (Gem::InstallError)
Gem::Installer#check_executable_overwrite at staging/lib/rubygems
{ } in Gem::Installer#generate_bin at staging/lib/rubygems/installer.rb:375
Array#each at kernel/bootstrap/array.rb:68
driv3r / Gemfile
Created Sep 24, 2012
sidekiq error
View Gemfile
source ''
gem 'rails'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://'
gem 'sqlite3'
gem 'sidekiq'
gem 'sinatra'
driv3r / Gemfile
Created Jan 20, 2012
Guardfile for rails app with spork and rspec with livereload
View Gemfile
gem "guard", require: false
gem "guard-rspec", require: false
gem "guard-spork", require: false
gem "guard-livereload", require: false
gem "rb-inotify", require: false # for guard on Linux
gem "libnotify", require: false # for guard-rspec notifications
driv3r / gist:1475171
Created Dec 14, 2011
Ruby/Gstreamer error
View gist:1475171
require 'gst'
unless ARGV.length == 1
$stderr.puts "Usage: #{__FILE__} <mp3 filename>"
exit 1
# create a new pipeline to hold the elements
pipeline =
View rvm-rubyinstall
Installing Ruby from source to: /home/driv3r/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...
ruby-1.9.3-p0 - #fetching
ruby-1.9.3-p0 - #downloading ruby-1.9.3-p0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0
21 9330k 21 1997k 0 0 2035 0 1:18:15 0:16:45 1:01:30 0^CERROR: There was an error, please check /home/driv3r/.rvm/log/ruby-1.9.3-p0/*.log. Next we'll try to fetch via http.
Trying http:// URL instead.