Skip to content

Instantly share code, notes, and snippets.

View dpaluy's full-sized avatar

David Paluy dpaluy

  • Majestic Labs
  • Austin, TX
  • X @dpaluy
View GitHub Profile
@dpaluy
dpaluy / README.md
Last active March 18, 2025 03:42
Use gemini-2.0-flash-exp for image editing

gemini-2.0-flash-exp for iamge editing via API

Notes and Requirements

  1. API Key: Replace 'YOUR_API_KEY' with your actual Google AI API key. You can obtain this from the Google Cloud Console after enabling the Gemini API.

  2. Dependencies: Install the required libraries: pip install google-generativeai pillow requests

  • google-generativeai: The official Python library for the Google Gemini API.
@dpaluy
dpaluy / CONVENTIONS.md
Created February 12, 2025 16:27 — forked from peterc/CONVENTIONS.md
CONVENTIONS.md file for AI Rails 8 development
  • You MUST NOT try and generate a Rails app from scratch on your own by generating each file. For a NEW app you MUST use rails new first to generate all of the boilerplate files necessary.
  • Create an app in the current directory with rails new .
  • Use Tailwind CSS for styling. Use --css tailwind as an option on the rails new call to do this automatically.
  • Use Ruby 3.2+ and Rails 8.0+ practices.
  • Use the default Minitest approach for testing, do not use RSpec.
  • Default to using SQLite in development. rails new will do this automatically but take care if you write any custom SQL that it is SQLite compatible.
  • An app can be built with a devcontainer such as rails new myapp --devcontainer but only do this if requested directly.
  • Rails apps have a lot of directories to consider, such as app, config, db, etc.
  • Adhere to MVC conventions: singular model names (e.g., Product) map to plural tables (products); controllers are plural.
  • Guard against incapable browsers accessing controllers with `allo
@dpaluy
dpaluy / architect.txt
Created February 11, 2025 23:26
RepoPrompt Helpers
You are a senior software architect specializing in code design and implementation planning. Your role is to:
1. Analyze the requested changes and break them down into clear, actionable steps
2. Create a detailed implementation plan that includes:
- Files that need to be modified
- Specific code sections requiring changes
- New functions, methods, or classes to be added
- Dependencies or imports to be updated
- Data structure modifications
- Interface changes
@dpaluy
dpaluy / prompt_optimizer.txt
Created January 22, 2025 19:50
Prompt Optimizer
You are an AI Prompt Builder Agent designed to refine prompts through a systematic five-step process. Follow these structured steps to analyze, enhance, and generate improved prompts. You aim to create updated versions labeled "Prompt 3" and "Prompt 5" by iteratively improving the original prompt.
Steps for Building Updated Prompts:
Initial Analysis:
Evaluate the original prompt on these criteria:
Clarity Score (0-10): How clear and understandable is the prompt?
Specificity Score (0-10): How precise and detailed is the instruction?
Effectiveness Score (0-10): How well can the prompt achieve its intended purpose?
Enhancement Potential (0-10): How much room is there for improvement?
@dpaluy
dpaluy / logo_service.rb
Created January 13, 2025 02:29
Get Logo from a domain
class LogoService < BaseService
EXTERNAL_URL = 'https://logo.clearbit.com'.freeze
attr_reader :domain, :image_object
def initialize(domain, image_object)
@domain = domain
@image_object = image_object
end
@dpaluy
dpaluy / alphabetize.rb
Created December 28, 2024 23:47
Always keep the order of schema.rb
task :'db:schema:dump' => :'db:alphabetize_columns'
task :'db:alphabetize_columns' do
class << ActiveRecord::Base.connection
alias_method :old_columns, :columns unless self.instance_methods.include?("old_columns")
def columns(*args)
old_columns(*args).sort_by(&:name)
end
end
@dpaluy
dpaluy / click_controller.js
Created December 24, 2024 01:47
Keyboard shortcuts for StimulusJS
// app/javascript/controllers/click_controller.js
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
click() {
this.element.click()
}
}
@dpaluy
dpaluy / debug.css
Created December 24, 2024 00:43
Debug CSS objects
.debug {
border: 1px solid rgb(34, 197, 94); /* green-500 */
.debug-tree,
.debug-tree * {
border: 1px solid rgb (239, 68, 68); /* red-500 */
}
strip = proc(&:strip)
downcase = proc(&:downcase)
remove_alias = proc { _1.gsub(/\+.*@/, '@') }
email = " [email protected] "
(strip >> downcase >> remove_alias).call(email) # => "[email protected]"
@dpaluy
dpaluy / .cursorrules
Last active March 9, 2025 13:30
CursorAI for Rails
# General Ruby Styling
PREFER_RUBY_SYNTAX: >
- Use Ruby 3.x syntax
- Use snake_case for methods and variables
- Use CamelCase for classes and modules
- Use SCREAMING_SNAKE_CASE for constants
- Prefer string interpolation over concatenation
- Use modern hash syntax: { key: value }
- Use double quotes only when interpolation is needed