Skip to content

Instantly share code, notes, and snippets.

View tmaier's full-sized avatar
🤓
I like pizza

Tobias L. Maier tmaier

🤓
I like pizza
View GitHub Profile

AppSignal issue #1222

$ bundle exec ruby before.rb 
render_partial.action_view
render_template.action_view
instantiation.active_record
sql.active_record
search.elasticsearch
request.faraday
@tmaier
tmaier / .editorconfig
Last active January 14, 2024 22:48
caddy-tailscale-poc
# EditorConfig is awesome: https://EditorConfig.org
# Top-most EditorConfig file
root = true
# All files
[*]
# Set the default charset to UTF-8
charset = utf-8
# Use spaces instead of tabs for indentation
@tmaier
tmaier / README.md
Created August 7, 2023 11:49
Custom RSpec/Capybara matchers for data-testid

See my blog post at https://tobiasmaier.info:

UI testing plays a crucial role in ensuring that our applications work correctly and consistently. Traditionally, people either matched strings, referenced CSS classes or element IDs. But the landscape of UI testing is shifting, introducing a new and improved approach: data-testid.

This blog post explains how to use Test IDs with RSpec and Capybara, and introduces two new RSpec matchers (have_test_id and have_test_id_and_css) to simplify UI testing.

Source:

@tmaier
tmaier / README.md
Last active April 1, 2023 22:50
Dry::Transaction/dry-transaction enqueue step adapter
@tmaier
tmaier / error_message_component.rb
Last active December 19, 2021 19:46
Sample implementation of hints and error_message for ViewComponent::Form https://github.com/pantographe/view_component-form/issues/36
# frozen_string_literal: true
class Form::ErrorMessageComponent < ViewComponent::Form::FieldComponent
def call
tag.p messages, class: 'mt-0.5 text-sm text-red-600'
end
def render?
method_errors?
end
@tmaier
tmaier / cancancan_issue_507.rb
Last active June 1, 2018 17:32 — forked from coorasse/main.rb
CanCanCan Issue
# Related issue: https://github.com/CanCanCommunity/cancancan/issues/507
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
0x9DA3Ff6fa502e51Cd934122Ed2f1dD961a46C876
@tmaier
tmaier / README.md
Last active December 30, 2015 15:17
Deprecate ruby methods
@tmaier
tmaier / response.rdf
Created December 22, 2014 16:28
CrossRef DOI example
<?xml version="1.0" encoding="UTF-8"?>
<doi_records>
<doi_record owner="10.1145" timestamp="2007-09-26 13:18:52">
<crossref>
<journal>
<journal_metadata language="en">
<full_title>ACM Transactions on Modeling and Computer Simulation</full_title>
<abbrev_title>ACM Trans. Model. Comput. Simul.</abbrev_title>
<abbrev_title>TOMACS</abbrev_title>
<issn media_type="print">10493301</issn>
@tmaier
tmaier / custom_plan.rb
Created December 31, 2013 10:33
Add Sidekiq support to Zeus. Allows to run Sidekiq with `zeus sidekiq`
require 'zeus/rails'
class CustomPlan < Zeus::Rails
def sidekiq
# Based on bin/sidekiq
require 'sidekiq/cli'
begin
cli = Sidekiq::CLI.instance
cli.parse