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 / .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 / bootstrap_topbar_list.rb
Created January 2, 2012 11:08
BootstrapTopbarList for simple-navigation and Twitter Bootstrap integration
# Renders an ItemContainer as a <ul> element and its containing items as <li> elements.
# Prepared to use inside the topbar of Twitter Bootstrap http://twitter.github.com/bootstrap/#navigation
#
# Register the renderer and use following code in your view:
# render_navigation(level: 1..2, renderer: :bootstrap_topbar_list, expand_all: true)
class BootstrapTopbarList < SimpleNavigation::Renderer::Base
def render(item_container)
if options[:is_subnavigation]
ul_class = "dropdown-menu"
@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 / 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
@tmaier
tmaier / README.md
Last active December 30, 2015 15:17
Deprecate ruby methods

Einwilligung in die Erhebung, Nutzung und Verarbeitung von Daten

Der Schutz Ihrer Daten ist für BauCloud GmbH, Denninger Straße 136, 81927 München, Deutschland ("BauCloud"), ein Anliegen mit allerhöchster Priorität.

Im Rahmen der Erbringung der BauCloud-Services werden nur solche nichtpersonenbezogenen und personenbezogenen Daten erhoben, verarbeitet und genutzt, die für die Erbringung der BauCloud-Services notwendig sind oder zu deren Erhebung, Verarbeitung oder Nutzung Sie durch Bestätigung dieser Datenschutzerklärung unter [Ziffer 4][4)] unten einwilligen.

1) Erhebung, Nutzung und Verarbeitung Ihrer Daten durch BauCloud und Weitergabe an Dritte

BauCloud wird insbesondere folgende Daten von Ihnen erheben: