Skip to content

Instantly share code, notes, and snippets.

View n3bulous's full-sized avatar

Kevin McFadden n3bulous

View GitHub Profile
---
description:
globs: spec/**/*
alwaysApply: false
---
# RSpec Testing Guidelines
## Core Principles
- Use RSpec for all tests
- Use FactoryBot for test data
---
description: Rules for creating Controllers
globs:
alwaysApply: false
---
# Modifying Rails controllers
## Routes
When adding new controllers or actions, don't forget to update the [routes.rb](mdc:config/routes.rb)

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.

@lloydwatkin
lloydwatkin / action_mailer_job.rb
Created November 7, 2024 11:45
ActionMailer using pure Sidekiq
# 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
@DmitryTsepelev
DmitryTsepelev / 0_README.md
Last active April 19, 2025 06:19
Terminal–based game tutorial

Sources for my blog post about terminal–based game

@wndxlori
wndxlori / send_to_kindle.rb
Last active April 15, 2024 20:00
When you have a whole LOT of ebooks to send to your Kindle
#!/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
@AliOsm
AliOsm / .env
Last active February 23, 2025 12:41
Deploy Rails, GoodJob, PostgreSQL, Redis, Memcached, Meilisearch, and ChromaDB on the same server using Kamal.
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
@jjb
jjb / file.md
Last active April 28, 2025 03:04
Using Jemalloc 5 with Ruby.md

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.

Ubuntu/Debian

FROM ruby:3.1.2-bullseye
RUN apt-get update ; \
@natematykiewicz
natematykiewicz / migrate-sidekiq-redis.rb
Last active February 21, 2024 17:18
Migrate Sidekiq Redis
# A script to migrate Sidekiq's redis to a new server.
# This obviously can work for any redis, but I only handled
# data types that Sidekiq uses.
require 'redis'
old_redis = Redis.new url: 'redis://old-redis:6379'
new_redis = Redis.new url: 'redis://new-redis:6379'
unknowns = []