Skip to content

Instantly share code, notes, and snippets.

View martinstannard's full-sized avatar
🏠
working from home

Martin Stannard martinstannard

🏠
working from home
View GitHub Profile
@peterc
peterc / CONVENTIONS.md
Last active April 23, 2025 06:55
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
@laky
laky / gist:79a266f10c90f1d8387e269ad208addd
Created January 23, 2023 11:25
Thiago Tweet Articles
Tweet link: https://twitter.com/thiagoghisi/status/1617249812432424960
Articles:
https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/
https://web.archive.org/web/20130721011202/http://agile2003.agilealliance.org/files/R1Paper.pdf
http://agilemodeling.com/essays/generalizingSpecialists.htm
https://brettsbabble.wordpress.com/2011/03/26/patterns-for-effective-acceptance-criteria/
https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/
http://www.exampler.com/testing-com/writings/coverage.pdf
https://mike-bland.com/2012/07/10/test-mercenaries.html
// by dave @beesandbombs
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 5, 2025 13:05
A badass list of frontend development resources I collected over time.
@machty
machty / new-router-examples.md
Last active April 16, 2020 22:03
How to do cool stuff with the new Router API
@ivanvanderbyl
ivanvanderbyl / account_routes.js
Last active January 31, 2016 17:55
Using Ember initializers and injections to setup the `currentUser` within your app.
App.AccountEditRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', this.get('currentUser'));
}
});
@chsh
chsh / app_delegate.rb
Created May 7, 2012 10:18
Example to use UIWebView for RubyMotion.
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame UIScreen.mainScreen.bounds
@window.rootViewController = GoogleViewController.alloc.init
@window.makeKeyAndVisible
true
end
end
@mindscratch
mindscratch / 1_intro_to_subject.rb
Created February 29, 2012 18:11 — forked from knzai/1_intro_to_subject.rb
A pattern for testing class methods in ruby with rspec explicit subjects
# RSpec's subject method, both implicitly and explicitly set, is useful for
# declaratively setting up the context of the object under test. If you provide a
# class for your describe block, subject will implicitly be set to a new instance
# of this class (with no arguments passed to the constructor). If you want
# something more complex done, such as setting arguments, you can use the
# explicit subject setter, which takes a block.
describe Person do
context "born 19 years ago" do
subject { Person.new(:birthdate => 19.years.ago }
it { should be_eligible_to_vote }
@elidupuis
elidupuis / handlebars-helpers.js
Last active December 7, 2021 02:24
Simple Handlebars.js helpers
/*! ******************************
Handlebars helpers
*******************************/
// debug helper
// usage: {{debug}} or {{debug someValue}}
// from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/)
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");