Instantly share code, notes, and snippets.

View spec_helper.rb
# frozen_string_literal: true
require_relative '../system/my_app/container'
module MyApp
module Tests
class Container < Dry::System::Container
use :env, inferrer: -> { 'test' }
configure do
View id_in_schema_spec.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/inline'
gemfile(true) do
gem 'dry-types', '0.13.3'
gem 'mysql2'
gem 'rom-repository', '2.0.2', require: false
View context.yml
- name: Adobe Systems
name2: Adobe Systems Inc.
symbol: ADBE
price: 39.26
change: 0.13
ratio: 0.33
- name: Advanced Micro Devices
name2: Advanced Micro Devices Inc.

ROM-SQL and serialized YAML data

New projects that use rom-db interact with existing db schemas quite often, especially with schemas that are built on top of Rails applications. And you can probably came across to a serialized YAML data here. ActiveRecord provides API to store unstructured key-value data into single database column with serialize method:

# Serialize preferences as Hash using YAML coder.
class User < ActiveRecord::Base
  serialize :preferences, Hash
View timezone_helper.rb
require 'faker'
RSpec.configure do |config|
config.before do
ENV['TZ'] = Faker::Address.time_zone
View Vagrantfile
# frozen_string_literal: true
# -*- mode: ruby -*-
# vi: set ft=ruby :
script = <<~SCRIPT
# Update apt and get dependencies
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y unzip curl vim \
apt-transport-https \
View karabiner.json
"title": "Diamond Cursor",
"rules": [
"description": "Change fn + I/J/K/L to Arrow Keys",
"manipulators": [
"type": "basic",
"from": {
"key_code": "i",
View latency.txt
Latency Comparison Numbers
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD

Keybase proof

I hereby claim:

To claim this, I am signing this object: