Skip to content

Instantly share code, notes, and snippets.

View rishiip's full-sized avatar
🎯
Focusing

Rishi Pithadiya rishiip

🎯
Focusing
View GitHub Profile
@rishiip
rishiip / prettier-eslint-precommit.md
Created January 10, 2023 09:04 — forked from estorgio/prettier-eslint-precommit.md
Setting up Prettier and ESLint with pre-commit hook

Setting up Prettier and ESLint with pre-commit hook

  • Initialize Git repository
    git init
  • Create .gitignore file and add the following:
    node_modules/
    *.env
    
@rishiip
rishiip / learning_basic_ruby.ipynb
Created June 5, 2021 07:32
Learning Basic Ruby
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rishiip
rishiip / find-slots.rb
Last active June 3, 2021 04:07
How I made 10 line ruby script to get my 1st jab done! 🤷🏼
# District - Pune, Date - Today's date. You can modify it as per your requirement.
uri = URI.parse("https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByDistrict?district_id=363&date=#{Date.today.strftime('%d-%m-%Y')}")
results = Net::HTTP.get(uri)
results = JSON.parse(results).with_indifferent_access
availability = {}
results[:centers].each do |center|
# 1st condition - Checking Age
sessions = center[:sessions].select{ |c| c[:min_age_limit] == 18 }
@rishiip
rishiip / education-policy.tsv
Last active April 4, 2021 12:25
New Education Policy - 2020
Initiative Benefit Drawback Suggestion for improvement
Education in mother language Very much beneficial for the students to understand in local/ mother languages, that will boost the level of understanding English is an international language, children must know it from childhood to have better place in jobs and to reduce differences between students who know English and who doesn’t know it. English should not be ignored completely. One subject of English language should be introduced from early childhood so that it will be easy for students to learn at early stage.
@rishiip
rishiip / .irbrc
Created June 7, 2020 15:57
This is my current irbrc file which contains lots of helpful things - Medium
require 'irb/completion'
require 'rubygems'
ActiveRecord::Base.logger.level = 1 if defined?(ActiveRecord)
IRB.conf[:SAVE_HISTORY] = 1000
# Overriding Object class
class Object
# Easily print methods local to an object's class
def lm
@rishiip
rishiip / gist:55014929f8341e8a942dee4ff3cb6de4
Created June 6, 2020 16:42 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@rishiip
rishiip / The Technical Interview Cheat Sheet.md
Created June 6, 2020 16:28 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@rishiip
rishiip / consider_my_requests_local.rb
Created May 27, 2020 18:21 — forked from skojin/consider_my_requests_local.rb
same as config.consider_all_requests_local but for production and only for specified ip address, rails 3.2
silence_warnings do
ActionDispatch::Request::LOCALHOST = (ActionDispatch::Request::LOCALHOST + ['192.168.0.1']).freeze
end
ActionController::Base.module_eval do
def show_detailed_exceptions?
request.local?
end
end
@rishiip
rishiip / irb_require_without_bundler_hack.rb
Created May 27, 2020 17:34 — forked from skojin/irb_require_without_bundler_hack.rb
workaround to load irb specific gem (loaded in .irbrc) in bundler environment, like rails3 console
# Add all gems in the global gemset to the $LOAD_PATH so they can be used in rails3 console with bundler
if defined?(::Bundler)
$LOAD_PATH.concat Dir.glob("#{ENV['rvm_path']}/gems/#{ENV['rvm_ruby_string']}@global/gems/*/lib")
end
@rishiip
rishiip / mongoid_counter_cache.rb
Created May 24, 2020 14:59 — forked from jeffreyiacono/mongoid_counter_cache.rb
counter cache extension for mongoid orm
module Mongoid
module CounterCache
extend ActiveSupport::Concern
module ClassMethods
# Use Case:
#
# keep a cached count of embedded collections in the parent collection(s)
#
# for example, if a Post embeds many Comments, and there have been 2