- 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 newfirst 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 tailwindas an option on therails newcall 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 newwill 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 --devcontainerbut 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
I found a hacky solution. We are overriding all the exceptions thrown by default. Then we are going to create custom interceptor to handle and throw exceptions. This way we can catch the DioException as we did before.
- Create a base client like this. You have to set validateStatus function to return
truewhatever the status code is.
final baseOptions = BaseOptions(
baseUrl: host,
contentType: Headers.jsonContentType,
validateStatus: (int? status) {
return status != null;
// return status != null && status >= 200 && status < 300;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| print_usage() { | |
| echo "usage: compress_video <input_file>" | |
| echo "supported formats: mp4, webm, mkv, mov, avi, flv" | |
| } | |
| get_extension() { | |
| f="${1##*/}" | |
| case "$f" in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| class ApplicationService | |
| def self.call(...) | |
| new(...).call | |
| end | |
| def initialize(...) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import fnmatch | |
| def get_comment_prefix(filename): | |
| extension_to_comment = { | |
| '.asm': (';', ';'), | |
| '.awk': ('#', '#'), | |
| '.c': ('//', '//'), | |
| '.clj': (';;', ';;'), | |
| '.cpp': ('//', '//'), |
# In your Gemfile
gem "localhost"
# Then, depending on your desired server
gem "falcon"
gem "puma"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # link UMC (Universal Modeline Calculator): | |
| # https://sourceforge.net/projects/umc/files/umc/umc-0.2/umc-0.2.tar.gz/download | |
| # compile umc with: "./configure" and "sudo make install" if error install dependencies and repeat. | |
| # chmod +x monitor.sh | |
| # ./monitor.sh | |
| # Alias on .zshrc | |
| # alias monitor='~/monitor.sh' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'fileutils' | |
| # Loop through all .jpg and .png files in the current directory | |
| Dir.glob("{*.jpg,*.png}").each do |img| | |
| # Construct the output filename with .webp extension | |
| output_filename = "#{File.basename(img, File.extname(img))}.webp" | |
| # Execute ffmpeg command to convert the image | |
| system("ffmpeg -i '#{img}' '#{output_filename}'") | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ "$UID" == "0" ]; then | |
| sudo_cmd='' | |
| else | |
| sudo_cmd='sudo' | |
| fi | |
| bash -c "$(curl -sL https://setup.vector.dev)" |