- 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
| function upload_media(imgURI) { | |
| var options = new FileUploadOptions(); | |
| options.fileKey="file"; | |
| var time = new Date().getTime(); | |
| var fileName = time+".jpg"; | |
| options.fileName = fileName; | |
| options.mimeType ="image/jpeg"; | |
| options.chunkedMode = false; | |
| var uri = encodeURI("http://<your bucket name>.s3.amazonaws.com/"); |
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 'rubygems' | |
| require 'aws/s3' | |
| AWS::S3::Base.establish_connection!( | |
| :access_key_id => 'MYACCESSKEYID', | |
| :secret_access_key => 'MYSECRETACCESSKEY' | |
| ) | |
| bucket = 'my-massive-files-bucket' | |
| objects = [] |
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
| package util; | |
| import java.io.File; | |
| import javax.sql.DataSource; | |
| import org.springframework.beans.factory.InitializingBean; | |
| import org.springframework.core.io.FileSystemResource; |
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
| #include <TinyGPS.h> | |
| #include <Wire.h> | |
| #include "DS3231.h" | |
| #include <SD.h> | |
| int ledPin = 13; | |
| TinyGPS gps; | |
| long lat, lon; |
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
| int buzzPin = 11; | |
| void setup() { | |
| Serial.begin(57600); | |
| pinMode(buzzPin, OUTPUT); | |
| } | |
| void loop() { |
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
| #include <SoftwareSerial.h> | |
| #define RxD 11 | |
| #define TxD 12 | |
| SoftwareSerial beeSerial = SoftwareSerial(RxD,TxD); | |
| void setup() { | |
| beeSerial.begin(57600); | |
| } |
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 'rubygems' | |
| require 'daemons' | |
| #require File.join(File.dirname(__FILE__), 'daemons_extension') | |
| ENV['RAILS_ENV'] ||= 'development' | |
| ENV['BUNDLE_GEMFILE'] ||= File.join(Dir.pwd, 'Gemfile') | |
| options = { | |
| :app_name => 'mail_consumer', | |
| :dir_mode => :script, |
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 'rubygems' | |
| require 'zip/zip' | |
| require 'zip/zipfilesystem' | |
| current_path = Dir.pwd | |
| scorm_file = current_path + "/" + tmp_dir + '/' + course + "/#{scorm_module}.zip" | |
| # module_path is where scorm files are (files to zip) | |
| Dir.chdir(module_path) | |
| files_to_zip = Dir["**/*"] |