Skip to content

Instantly share code, notes, and snippets.

View sponomarev's full-sized avatar
🔴
Offline

Sergey Ponomarev sponomarev

🔴
Offline
View GitHub Profile
@sponomarev
sponomarev / README.md
Created October 29, 2018 15:23 — forked from joyrexus/README.md
Functional config in go

Quick demo of how to initialize your data structure with optional configuration parameters ... with sane defaults if left unspecified.

This functional config technique ...

  • lets you write APIs that can evolve without pain
  • provides meaningful configuration parameters
  • makes it easy to set default settings
  • makes it possible to set complex conditional values
@sponomarev
sponomarev / alias_matchers.md
Created July 10, 2018 13:38 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@sponomarev
sponomarev / documents.rb
Last active August 29, 2015 14:17 — forked from dhh/documents.rb
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@sponomarev
sponomarev / Gemfile
Created January 29, 2014 11:45 — forked from gvarela/Gemfile
# A sample Gemfile
source "http://rubygems.org"
gem "redis"
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git'
gem "em-hiredis"
# gem "em-synchrony"
gem "em-websocket"
require 'rubygems'
require 'eventmachine'
module ChatClient
def self.list
@list ||= []
end
def post_init
@name = "anonymous_#{rand(99999)}"