Skip to content

Instantly share code, notes, and snippets.

View ParthBarot-BoTreeConsulting's full-sized avatar

Parth Barot ParthBarot-BoTreeConsulting

View GitHub Profile
@ParthBarot-BoTreeConsulting
ParthBarot-BoTreeConsulting / READ_ME.md
Last active October 13, 2015 19:38
Rails Cheatsheet - basic rules to remember and use in every code you write

Some basic rules to follow, for diff. rails components. Please add comment if you want to add anything.

##Controllers

  1. Extract common code in controller action, which loads data from DB using finder methods with params as arguments.
  2. Same for any service object loading.
  3. Above two cases, if being used in more than one controller, then define a concern using included do before_action :finder_method end and include that in both.
  4. Do not write separate controller for API, instead use respond_to with diff. data format.
@apollolm
apollolm / nginx-ssl-config
Last active January 12, 2023 14:47
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}
@omnisis
omnisis / protocol.rb
Created November 2, 2012 04:42
Ruby UDP Server/Client Pair with Custom Binary Protocol
require 'bindata'
class CustomProtocol < BinData::Record
endian :big
stringz :command_word
uint8 :op1
uint8 :op2
end