Skip to content

Instantly share code, notes, and snippets.

View overdrivemachines's full-sized avatar

Dipen Chauhan overdrivemachines

View GitHub Profile
@overdrivemachines
overdrivemachines / template.rb
Last active January 28, 2024 08:40
template.rb - Ruby on Rails Template
require 'net/http'
require 'uri'
# === Remove Comments in Gemfile ===
# Path to the Gemfile
gemfile_path = 'Gemfile'
# Read the content of the Gemfile
gemfile_content = File.read(gemfile_path)
# Remove comments from the Gemfile
gemfile_content.gsub!(/^#.*$/, '')
@overdrivemachines
overdrivemachines / gemfile.md
Created November 21, 2023 00:42
Gems Added to Gemfile and Configuration
  • Add gems to Gemfile:
gem "sassc-rails"
gem "image_processing", "~> 1.2"
gem "devise"


# In development group:
gem "rails-erd"
@overdrivemachines
overdrivemachines / vscode_global_gems.sh
Created November 21, 2023 00:18
Gems used by VSCode
gem install solargraph
gem install rubocop
gem install rubocop-performance
gem install rubocop-rails
gem install rubocop-rspec
gem install rubocop-md
gem install erb-formatter
gem install htmlbeautifier
@overdrivemachines
overdrivemachines / settings.json
Last active November 21, 2023 01:04
VSCode Settings (located in ~/Library/Application Support/Code/User/settings.json)
{
"[erb]": {
"editor.defaultFormatter": "aliariff.vscode-erb-beautify",
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[ruby]": {
"editor.defaultFormatter": "misogi.ruby-rubocop"
@overdrivemachines
overdrivemachines / .rubocop.yml
Last active January 28, 2024 08:39
Rubocop
require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- rubocop-md
AllCops:
NewCops: enable
Exclude:
- "vendor/**/*"
@overdrivemachines
overdrivemachines / python.md
Last active August 14, 2023 04:10
Python Guide

Python Guide

Naming Conventions

  • Variables, Functions: snake_case
  • Class Names: CamelCase, MyClass, PersonDetails

Data Structures

Lists

my_list = [1, 2, 3, 4, 5]
@overdrivemachines
overdrivemachines / windows11.md
Last active August 2, 2023 01:49
Things to do after installing Windows 11

GPG Keys

  • Find link to GPG key online and save it in usr/share/keyrings/ with the command:
wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnpkg.gpg > /dev/null
  • Create yarnpkg.list in etc/apt/sources.list.d/ with the contents:
deb [signed-by=/usr/share/keyrings/yarnpkg.gpg] https://dl.yarnpkg.com/debian/ stable main
@overdrivemachines
overdrivemachines / update.sh
Created February 17, 2023 00:06
Update code (git pull) on production server
#!/bin/bash
# Place this file in /var/www/myapp folder
cd code
git pull
bundle config set --local deployment 'true'
bundle config set --local without 'development test'
bundle install
bundle exec rake assets:precompile db:migrate RAILS_ENV=production
passenger-config restart-app $(pwd)
@overdrivemachines
overdrivemachines / email-production-rails.md
Last active November 11, 2022 08:16
Send emails in production environment Ruby on Rails

Generate Gmail App Password

Go to https://myaccount.google.com/apppasswords and generate an App Password

Save App Password

In terminal open the rails credentials

rails credentials:edit

Save the following info: