Skip to content

Instantly share code, notes, and snippets.

@exsemt
exsemt / Gemfile
Created May 13, 2020 21:30 — forked from ota42y/Gemfile
committee benchmark
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "committee"
gem "sinatra"
gem "pry"
gem "pry-byebug"
require 'benchmark'
require "committee"
COUNT = 10000
noop = Proc.new {[200, {}, ["hello"]]}
middleware = Committee::Middleware::RequestValidation.new(noop, schema_path: 'demo.yaml')
# warmup
request = Rack::MockRequest.new(middleware)
@exsemt
exsemt / Capybara.md
Created December 5, 2019 16:19 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@exsemt
exsemt / ConditionalValidations.rb
Created July 12, 2016 10:55 — forked from ibanez270dx/ConditionalValidations.rb
A simple module that allows validation of only certain attributes of any given model. Created for CoverHound.com.
#
# At CoverHound, we use conditional validations all over the form. However, there is no proper way to do
# this in Rails. Instead, we can provide an array of attributes (validated_fields attribute)
# and ensure they are the only ones to get validated.
#
module ConditionalValidations
attr_accessor :validated_fields
def field_is_required?(field)