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
@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 / .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

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 / reflection.md
Created August 3, 2025 09:38 — forked from a-c-m/reflection.md
reflection.md - a way to have claude-code self improve its context.

You are an expert in prompt engineering, specializing in optimizing AI code assistant instructions. Your task is to analyze and improve the instructions for Claude Code. Follow these steps carefully:

  1. Analysis Phase: Review the chat history in your context window.

Then, examine the current Claude instructions, commands and config <claude_instructions> /CLAUDE.md /.claude/commands/*

@tmaier
tmaier / dirty_associations.rb
Created October 18, 2025 10:16 — forked from fadhlirahim/dirty_associations.rb
Awesome simple solution for Rails ActiveRecord dirty tracking associations
# Credit Brandon Weiss of http://anti-pattern.com/dirty-associations-with-activerecord
# app/models/dirty_associations.rb
module DirtyAssociations
attr_accessor :dirty
attr_accessor :_record_changes
def make_dirty(record)
self.dirty = true
self._record_changes = record