Skip to content

Instantly share code, notes, and snippets.

@rwarbelow
rwarbelow / running_app_in_production_locally.markdown
Created November 11, 2015 18:26
How to Run a Rails App in Production Locally
  1. Add gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.
  2. bundle
  3. Run RAILS_ENV=production rake db:create db:migrate db:seed
  4. Run rake secret and copy the output
  5. From the command line: export SECRET_KEY_BASE=output-of-rake-secret
  6. To precompile your assets, run rake assets:precompile. This will create a folder public/assets that contains all of your assets.
  7. Run RAILS_ENV=production rails s and you should see your app.

Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.

@abhianair
abhianair / custom_calendar.js
Created April 5, 2019 12:05
Dynamic custom calendar where day cell is text area Using Jquery.
$( document ).on('turbolinks:load', function() {
var deferentMonth = 0;
var prevEl = document.getElementById('ac-prev'), // get the ID of the prev month button
nextEl = document.getElementById('ac-next'), // get the date of the next month button
daysEl = document.getElementById("custom_calndar2");
const months = [
"JANUARY",
"FEBRUARY",
"MARCH",
"APRIL",
@abhianair
abhianair / app.js
Created March 24, 2020 10:03
Jquery function wrapping
var main = (function($, window, document){
function object(){
// scripts
return{
object : object,
};