Skip to content

Instantly share code, notes, and snippets.

View lonbaker's full-sized avatar

Lon Baker lonbaker

View GitHub Profile
@lonbaker
lonbaker / CONVENTIONS.md
Created February 21, 2025 21:28 — 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
### Keybase proof
I hereby claim:
* I am lonbaker on github.
* I am lonbaker (https://keybase.io/lonbaker) on keybase.
* I have a public key ASCUMW6Pw9uM_opLGdpz_NCqjeLmKlA2ItKgR9Geh-JOdgo
To claim this, I am signing this object:
set theURLs to {}
set Urls to paragraphs of (read POSIX file "/Users/lonbaker/Desktop/Urls.txt")
repeat with nextLine in Urls
if length of nextLine is greater than 0 then
copy nextLine to the end of theURLs
end if
end repeat
-- add URLs to reading list
my addToReadingList(theURLs)
set theURLs to {}
set Urls to paragraphs of (read POSIX file "/Users/username/Desktop/Urls.txt")
repeat with nextLine in Urls
if length of nextLine is greater than 0 then
copy nextLine to the end of theURLs
end if
end repeat
-- add URLs to reading list
my addToReadingList(theURLs)

Keybase proof

I hereby claim:

  • I am lonbaker on github.
  • I am lonbaker (https://keybase.io/lonbaker) on keybase.
  • I have a public key whose fingerprint is 71F5 863D C755 E67B 2796 4A4C 86C2 5FB0 0411 7CBE

To claim this, I am signing this object:

@lonbaker
lonbaker / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/*
smtpd.js is SMTP server written for node.js
MIT License
*/
var tcp = require('tcp');
var sys = require('sys');
@lonbaker
lonbaker / tcp_syslog.rb
Created September 27, 2010 16:37 — forked from gravis/readme
require 'socket'
require 'syslog'
require 'logger'
require 'hoptoad_notifier'
# TcpSyslog is used are a dead-simple replacement for
# syslog ruby libs. None of them is able to send logs
# to a remote server, and even less in TCP.
#
# Example:
@lonbaker
lonbaker / gist:179609
Created September 2, 2009 08:16 — forked from csexton/gist:69329
["http://internal/", "http://external/"].each do |server|
uri = URI.parse(server)
God.watch do |w|
w.name = "httpmon_#{uri.host}"
w.interval = 10.seconds
w.start = "echo 'start'"
w.stop = "echo 'stop'"
w.lifecycle do |on|
on.condition(:http_response_code) do |c|
#!/usr/bin/env ruby
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
start_time = Time.now
puts "Starting CouchDB Benchmark..."
100000.times do |n|
Person.new(:first_name => "Couch_#{n}", :last_name => "Man_#{n}").save
end
puts (Time.now - start_time)