Skip to content

Instantly share code, notes, and snippets.

View raluka's full-sized avatar
:octocat:

Raluca Badoi raluka

:octocat:
View GitHub Profile
@raluka
raluka / CONVENTIONS.md
Created February 21, 2025 17:11 — 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
@raluka
raluka / describe vs. context in rspec
Created November 9, 2022 11:31 — forked from kyuden/describe vs. context in rspec
describe vs. context in rspec
describe vs. context in rspec
http://lmws.net/describe-vs-context-in-rspec
In Rspec world, you often see people using both “describe” blocks and “context” blocks together, like this
describe "launch the rocket" do
context "all ready" do
end
context "not ready" do
@raluka
raluka / strip HTML tags
Created August 19, 2019 16:11 — forked from awesome/strip HTML tags
ruby strip HTML tags
# copied from (thanks!): http://codesnippets.joyent.com/posts/show/615
str = <<HTML_TEXT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h1>Application error</h1>
<p>Change this error message for exceptions thrown outside of an action (like
in Dispatcher setups or broken Ruby code) in public/500.html</p>
@raluka
raluka / stdin.rb
Last active August 29, 2015 14:20 — forked from defunkt/stdin.rb
class MyApp
attr_accessor :input, :output
def initialize
@input = $stdin
@output = $stdout
end
def prompt_user
user_selection = gets.chomp # => 'ponies'
@raluka
raluka / README.md
Last active August 29, 2015 14:17 — forked from ndreynolds/README.md

Zug Simulator

In this exercise, we'll model the behavior of an U-Bahn or S-Bahn train.

Given a route which provides stations (just strings), the train's current station, and whether or not it's traveling in reverse (i.e., from the last stop to the first stop), the train should complete the route in the correct direction.

When the train's complete_route method is called, it should print a summary