Skip to content

Instantly share code, notes, and snippets.

View jigneshkhokhani's full-sized avatar
🎯
Focusing

Jignesh Khokhani jigneshkhokhani

🎯
Focusing
View GitHub Profile
@jigneshkhokhani
jigneshkhokhani / Dockerfile
Created April 11, 2023 14:35
angular-new-docker-app-creator : Create new angular app from docker it-self. It will create full angular directory without installing anything in local system.
FROM node:16-alpine
WORKDIR /front-app
COPY package*.json ./
RUN npm install
# Mentioned exposed port for documentation
EXPOSE 4200
@jigneshkhokhani
jigneshkhokhani / .devcontainer/devcontainer.json
Last active October 9, 2023 05:18
rails-new-docker-app-creator : Create new rails app from docker itself. It will create full rails directory without installing anything in local system.
// This devcontainer.json file can be generated automatically from the VS-Code itself.
// This is just for reference purposes.
// Additionally, It provides a way of how to install VS-Code extensions automatically after devcontainer launched up
// using "customizations" options
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "AirBNB-Colne with Existing Docker Compose (Extend)",
@jigneshkhokhani
jigneshkhokhani / encrypted_coder.rb
Created February 23, 2018 15:23
[Encrypt/Decrypt] Load after decrypt and dump after encrypt in DB
# lib/encrypted_coder.rb
class EncryptedCoder
include Crypt
def load(value)
return unless value.present?
Marshal.load(
Crypt.decrypt(
Base64.decode64(value)))
@jigneshkhokhani
jigneshkhokhani / crypt.rb
Created February 23, 2018 15:20
[Encrypt/Decrypt] Encrypt and decrypt rails data
# lib/crypt.rb
module Crypt
class << self
def encrypt(value)
crypt(:encrypt, value)
end
def decrypt(value)
crypt(:decrypt, value)
@jigneshkhokhani
jigneshkhokhani / application_controller.rb
Last active April 30, 2021 12:23
medium-(Rails API + Doorkeeper + Devise)
class ApplicationController < ActionController::API
# Devise code
before_action :configure_permitted_parameters, if: :devise_controller?
# Doorkeeper code
before_action :doorkeeper_authorize!
respond_to :json
protected