Skip to content

Instantly share code, notes, and snippets.

View shah743's full-sized avatar
🏠
Working from home

Shah Zaib shah743

🏠
Working from home
  • Islamabad, PK
View GitHub Profile
@shah743
shah743 / deploy-yml.md
Last active October 8, 2024 12:37
Deploying Rails 7+ Apps with Kamal Gem on Digital Ocean

Description: A comprehensive guide to deploying Rails 7.1+ applications using the Kamal gem and Digital Ocean. This guide covers installation, configuration, and deployment steps with detailed instructions and example configuration files.

Rails 7.1 and Docker

With Rails 7.1, Docker files come by default.

Kamal Configuration

Install Kamal Gem

@withoutwax
withoutwax / ror-api.markdown
Last active January 24, 2024 16:28
Guide on how to create an API-Only Application with Ruby on Rails 5

Creating an API-Only Application with Ruby on Rails

01 - Create a new API-only Rails app

rails new ror-app-name --api

02 - Basic Scaffold

01 - Model

This step is for creating a very basic level of model for us to work in. If you know already, or wish to apply your own custom models with relationships you can skip this step.

@shah743
shah743 / compression.rb
Created August 31, 2016 09:45 — forked from remino/compression.rb
Ruby on Rails: Minify HTML, CSS, & JS, and compress with gzip https://remino.net/rails-html-css-js-gzip-compression/
# config/initializers/compression.rb
Rails.application.configure do
# Use environment names or environment variables:
# break unless Rails.env.production?
break unless ENV['ENABLE_COMPRESSION'] == '1'
# Strip all comments from JavaScript files, even copyright notices.
# By doing so, you are legally required to acknowledge
# the use of the software somewhere in your Web site or app:
# config/routes.rb
%w( 404 422 500 ).each do |code|
get code, :to => "errors#show", :code => code
end
# app/views/errors/404.html.haml
%h1 404 - Not Found
class ErrorsController < ApplicationController
@shah743
shah743 / rails_confirm_override.js.coffee
Last active January 26, 2016 04:37 — forked from stevenspiel/rails_confirm_override.js.coffee
Replace Rails confirm with sweetalert2 popup. (https://github.com/limonte/sweetalert2). It overrides the default javascript (from jquery_ujs), which skips any other popup.
$.rails.allowAction = (link) ->
if link.data('confirm')
$.rails.showConfirmationDialog(link)
false
else
true
# User click confirm button
$.rails.confirmed = (link) ->
link.data('confirm', null)