Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

1. Install ollama from www.ollama.com | |
2. Install python | |
3. `pip install ollama` | |
4. `ollama pull llama3.2-vision:latest` | |
5. Put the `rename_images.py` script in the folder of your choice | |
6. Edit the script and update the `IMAGE_FILE_NAME_PATTERN` if yours is different | |
7. Run `python rename_images.py` |
# frozen_string_literal: true | |
module Fingerprinting | |
def full_fingerprint | |
generate_fingerprint( | |
ip_fingerprint, | |
browser_fingerprint | |
) | |
end |
while bundle exec rake test; do :; done |
namespace :db do | |
desc 'reset the database by dropping the schema' | |
task complete_reset: :environment do | |
raise unless Rails.env.local? | |
FileUtils.rm_f('db/schema.rb') | |
Rake::Task['db:drop'].invoke | |
Rake::Task['db:create'].invoke | |
Rake::Task['db:migrate'].invoke | |
Rake::Task['db:seed'].invoke |
# Prompt: | |
What’s your most elegant Ruby code that does this: | |
* takes an array of strings and a target string | |
* if the target string is not in the array, return the array | |
* if the target string is in the array, return the array with the target string moved from its position to the end of the array. | |
What’s your most elegant Ruby code that does this: | |
* takes an array of strings and a target string |
This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!
Want more content like this, for free? Check out my free book, RailsAI!
def self.included(base) | |
base.instance_variable_set(:@count, 0) unless base.instance_variable_defined?(:@count) | |
base.instance_variable_set(:@count, base.instance_variable_get(:@count) + 1) | |
puts base.name if base.instance_variable_get(:@count) > 1 | |
end |
# frozen_string_literal: true | |
# ActiveRecord::Enum validation in Rails API | |
# https://medium.com/nerd-for-tech/using-activerecord-enum-in-rails-35edc2e9070f | |
module EnumValidatable | |
extend ActiveSupport::Concern | |
class_methods do | |
def validatable_enum(*enums_to_fix) | |
enums_to_fix.each do |element| |
on: | |
workflow_call: | |
inputs: | |
deploy_target: | |
description: 'Deploy target' | |
required: true | |
type: string | |
default: 'production' | |
secrets: | |
GH_TOKEN: |