Skip to content

Instantly share code, notes, and snippets.

# This beeing a plain ruby file do whatever you what
# like requiring some organization wide baseline rubocop config
# or a todo file
PoC.configure do |config|
# I've yet to find a better solution for the namespaceing issue so I can
# directly access the Metrics module
# even with a instance_eval/instance_exec from within the PoC module I have
# to call PoC::Cop::Metrics...
include PoC::Cop
@andreaseger
andreaseger / .ruby-version
Last active August 29, 2015 14:17
active_type bug
ruby-2.2.0
require 'bundler/inline'
gemfile true do
source 'https://rubygems.org'
gem 'active_model_serializers', github: 'rails-api/active_model_serializers', ref: 'd30aa4c'
end
print "==================================================\n\n"
class Shoe
attr_accessor :id, :name, :vendor
require 'bundler/inline'
gemfile true do
source "https://rubygems.org"
gem 'msgpack'
end
puts "#" * 90
puts "#{RUBY_ENGINE} #{RUBY_VERSION} #{RUBY_PLATFORM}"
puts "MessagePack::VERSION: #{MessagePack::VERSION}"
#!/usr/bin/env ruby
require "bundler/inline"
gemfile true do
source "https://rubygems.org"
gem "dry-validation", github: "dry-rb/dry-validation"
end
module Types
include Dry::Types.module
require 'bundler/inline'
gemfile true do
gem 'dry-types'
end
include Dry::Types.module
class A < Dry::Types::Struct
attribute :a, Strict::Int
end
@andreaseger
andreaseger / init_dot_files.sh
Created December 8, 2016 00:05
script to init my dot-files
git clone https://github.com/andreaseger/dot-files /tmp/dot-files --no-checkout
mv /tmp/dot-files/.git ~/.git
rm /tmp/dot-files -rf
cd ~
git reset HEAD
git checkout .
git submodule update --init
defmodule DynamicRoutingTest do
use ExUnit.Case
doctest DynamicRouting
test "match" do
:routes = :ets.new(:routes, [:named_table, :bag, :public])
method = :get
service = :articles
[["v1", "users"],
["v2", "users"],
@andreaseger
andreaseger / nest_array_test.rb
Created June 19, 2017 11:43
list of arrays to nested hash tree
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'minitest', require: false
end
require 'minitest/autorun'
module DeepMerge