- 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 therails 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
# rack_sse.ru | |
# | |
# An example of basic real-time, single-room broadcast chat using Server Sent | |
# Events in plain old Rack. This example does NOT use hijack, or the async | |
# hacks, it just relies on a well implemented threaded Rack server (at time of | |
# writing this will therefore only work with puma!). Other servers should be | |
# fixed to support this, as it is pretty critical to how Rack *should* work on | |
# most servers. The only spec-acceptable failure in this case is not flushing | |
# the content stream on each yield (for which the rack spec has no workaround | |
# today). |
You are Manus, an AI agent created by the Manus team. | |
You excel at the following tasks: | |
1. Information gathering, fact-checking, and documentation | |
2. Data processing, analysis, and visualization | |
3. Writing multi-chapter articles and in-depth research reports | |
4. Creating websites, applications, and tools | |
5. Using programming to solve various problems beyond development | |
6. Various tasks that can be accomplished using computers and the internet |
You simulate a group of expert software developers, engineers and architects who debate and analyze an application development idea in order to ultimately produce a robust spec. Each participant has a unique perspective, engages in natural discussion, and refines ideas through back-and-forth exchange. The goal is to explore concepts, challenge assumptions, and reach well-reasoned conclusions. | |
This is an on-going conversation between an external user who is asking for a piece of software to be built and the group of experts. | |
## Output Format | |
1. Simulate a technical debate** where ideas and answers emerges organically. | |
2. Use a play script style where when someone speaks, their name is included at the start of each line. | |
3. You must end with a pertinent question for the user to answer in order to productively continue the debate. Format the answer like so: "QUESTION: Question goes here." This must be the very final paragraph of your response. | |
4. If the group is satisfied they have all the answers needed to pr |
Let's say you want to use Ruby for the backend of a basic webapp but React on the frontend. Here's how.
(Note: All tested on January 13, 2025 with Ruby 3.3, Sinatra 4.1.1, and React 18.3. Configs may change over time.)
First, create the app folder and set up Sinatra:
mkdir my-sinatra-react-app
# ----------------------------------------------------------------------------- | |
# AI-powered Git Commit Function | |
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It: | |
# 1) gets the current staged changed diff | |
# 2) sends them to an LLM to write the git commit message | |
# 3) allows you to easily accept, edit, regenerate, cancel | |
# But - just read and edit the code however you like | |
# the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/ | |
gcm() { |
class BaseClient | |
class APINotFound < StandardError; end | |
attr_reader :auth_strategy | |
def initialize(auth_strategy: :headers, headers: {}) | |
@auth_strategy = auth_strategy | |
@headers = headers | |
end |
Before delving into how we support database (DB) transactions, let's first consider how we can handle operations that only pertain to the unhappy path. This consideration is important because, as we will see, it will become relevant when we reach the main topic.
Most of the time, the unhappy path is something managed by the caller (e.g., a controller rendering an error in case of failure). However, there are situations where it makes sense to encapsulate part of the unhappy path within the operations class. For instance, you might want to log the failure somewhere.
When relying on the vanilla #steps
method, the implementation is straightforward:
class CreateUser < Dry::Operation
# Set the platform at the top | |
platform :osx, '10.15' | |
# Rest of the pod file | |
# Update post_install step | |
post_install do |installer| | |
# Ensure pods use the minimum deployment target set above | |
# https://stackoverflow.com/a/64385584/436422 | |
pods_project = installer.pods_project |
module ArrayColumns | |
extend ActiveSupport::Concern | |
class_methods do | |
def array_columns_sanitize_list(values = []) | |
return [] if values.nil? | |
values.select(&:present?).map(&:to_s).uniq.sort | |
end | |
def array_columns(*column_names) |