This is a Ruby on Rails application that helps users with benefits applications. The application uses:
- Ruby on Rails 8
- PostgreSQL database
- Bootstrap 5.3 for UI styling
- Hotwire (Turbo and Stimulus) for frontend interactivity
- RSpec for testing
import {Controller} from "@hotwired/stimulus" | |
// Warns if form fields have unsaved changes before leaving the page. | |
// Changes are stored in Session Storage to restore un-warnable events | |
// like using the back button | |
// | |
// To use: | |
// <form data-controller="unsaved-changes"> | |
// <input type="text" name="name" data-unsaved-changes-target="field"> | |
export default class extends Controller { |
--- | |
description: | |
globs: spec/**/* | |
alwaysApply: false | |
--- | |
# RSpec Testing Guidelines | |
## Core Principles | |
- Use RSpec for all tests | |
- Use FactoryBot for test data |
My theory is that folks are hallucinating complex structure for these docs. If you read the Cursor forums, people are asking the Cursor LLM how to format them 🙃 Those shared above are the results of writing in the UI and what gets puts into version control.
My approach is that when I am annoyed by something I have to manually fix up, I go update the file.
Some of it is just impossible, like using the new Strong Params expects syntax given the training cutoffs. I’m not going to completely document the interface (cursor/rules can’t link to docs and can only link to a single file) . So I hint it, and it simply hallucinates the interface mostly correctly most of the time. Principle of Least Surprise in practice!
My .cursorrules were pretty inconsistent project to project, and I don’t believe that putting very generic things like “Use exceptions for exceptional cases, not for control flow” or “Use Active Record effectively” improves things.
# i.e. Sidekiq job | |
class ApplicationMailerJob | |
include Sideiq::Worker | |
sidekiq_options queue: "low_priority" | |
def perform(mailer, action, arguments) | |
mailer.constantize.send(action, arguments).deliver_now | |
end |
Sources for my blog post about terminal–based game
#!/Usr/bin/env ruby | |
require 'mail' | |
require 'fileutils' | |
# Check if a command line argument is provided | |
if ARGV.length < 1 | |
puts "Usage: ruby send_to-kindle.rb <directory containing epub files>" | |
exit 1 |
KAMAL_REGISTRY_PASSWORD=dckr_pat_xXXxx_x0xXxXx-xX-XXX0xX0x-x | |
RAILS_MASTER_KEY=00x00xxx000xxx000000xx0x000x0x00 | |
POSTGRES_PASSWORD=xXxxx0xXXx0 | |
MEILI_MASTER_KEY=xXxxx0xXXx0 | |
BLAZER_DATABASE_URL=postgres://service:{POSTGRES_PASSWORD}@service-name-postgres:5432/service_production |
For years, people have been using jemalloc with ruby. There were various benchmarks and discussions. Legend had it that Jemalloc 5 didn't work as well as Jemalloc 3.
Then, one day, hope appeared on the horizon. @wjordan offered a config for Jemalloc 5.
FROM ruby:3.1.2-bullseye
RUN apt-get update ; \