Skip to content

Instantly share code, notes, and snippets.


The Problem

bundle install
> Fetching source index from
> Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from
> Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from
> Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from
> Could not fetch specs from
yevgenko / flatfile_io_json2csv.rb
Last active Jul 16, 2019
Convert output (key-value map) to CSV string.
View flatfile_io_json2csv.rb
require 'csv'
require 'json'
def flatfile_io_json2csv_string(data_as_string = '[{"sku_code": "123"}, {"sku_code": "321"}]')
CSV.generate do |csv|
json_data = JSON.parse(data_as_string)
csv << json_data.first.keys # header
json_data.each do |hash|
csv << hash.values
yevgenko / single_message_listener.rb
Created May 1, 2019
GOOS: auction snipper, single message listener
View single_message_listener.rb
class SingleMessageListener
include RSpec::Matchers
def initialize
@messages =
yevgenko / self_shunt_spec.rb
Created Mar 5, 2019
Self Shunt vs Fake Object in Ruby / RSpec
View self_shunt_spec.rb
module Fubarizable
def fubarize
class FakeFoobar
include Fubarizable
def fubarizable
docker run -p 9200:9200 -e "" -e ""
View designing_end_to_end_test.txt
title Designing End To End Test
Test->ApplicationRunner: perform_foobar_for(order)
ApplicationRunner->OrderPage: perform_action(Order::ACTION_FOOBAR)
OrderPage->CapybaraPage: visit('/orders/')
OrderPage->CapybaraPage: click(text)
Test->ApplicationRunner: has_shown_foobar_status_for(order)
ApplicationRunner->OrderPage: shows_status(Order::STATUS_FOOBAR)
OrderPage->CapybaraPage: visit('/orders/')
OrderPage->CapybaraPage: assert_text(text)
View foobar.rb
def greeting
puts 'hello, world!'
yevgenko / big_money_spec.rb
Last active Apr 3, 2018
Forcing monetization to produce money in specific currency only
View big_money_spec.rb
require 'money'
class BigMoney
class << self
attr_accessor :current_currency
def force_currency(currency_code)
self.current_currency =
self.current_currency = nil
View active_record_spec_helper.rb
require 'active_record'
require 'database_cleaner'
require 'yaml'
connection_info = YAML.load("config/database.yml")).result)["test"]
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
# Converts MTS files into m4v in a bulk
# with avconvert tool
# Usage:
# create directories ./in and ./out
# put files into in directory
# run the command:
# python
You can’t perform that action at this time.