This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'actionpack', '~> 5.2', '>= 5.2.1' | |
gem 'rails' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# minimal example for singleton pattern | |
class Configs | |
class << self | |
def instance | |
@instance ||= new | |
end | |
private :new | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. git stash list | |
List out all stash entries that we have currently. stash entries are listed with name and latest entries first | |
ex: | |
git stash list | |
# example result | |
stash@{0}: On development: WIP README | |
stash@{1}: WIP on development: 1b78aaa7 | |
2. git stash OR git stash push | |
This command saves your local changes to new stash entry and moves back the local working directory to the remote head. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :app_task do | |
desc 'run web task' | |
task :run_web do | |
# my web task logic here | |
end | |
desc 'run backend task' | |
task :run_backend do | |
# my backend task logic here | |
# after this invoke other rake task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"root": true, | |
"extends": [ | |
"eslint:recommended", | |
"plugin:import/errors", | |
"plugin:import/warnings" | |
], | |
"parserOptions": { | |
"ecmaVersion": 7, | |
"sourceType": "module" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "js-dev-env", | |
"version": "1.0.0", | |
"description": "Javascript develeopment environment setup", | |
"scripts": { | |
}, | |
"author": "Rakesh Verma", | |
"license": "MIT", | |
"dependencies": { | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Matrix | |
class << self | |
def to_spiral(input_array) | |
array_length = input_array.length | |
# return element itself if array length is 1 | |
return input_array[0][0] if array_length == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/routes.rb | |
resources :documents do | |
resources :versions, controller: "documents/versions" do | |
post :restore, on: :member | |
end | |
resource :lock, controller: "documents/locks" | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MODEL | |
class Case < ActiveRecord::Base | |
include Eventable | |
has_many :tasks | |
concerning :Assignment do | |
def assign_to(new_owner:, details:) | |
transaction do |
NewerOlder