Skip to content

Instantly share code, notes, and snippets.

View pbharadiya's full-sized avatar
🎯
Happy Coding!

Parth Bharadiya pbharadiya

🎯
Happy Coding!
View GitHub Profile
@pbharadiya
pbharadiya / generic_job.rb
Created July 21, 2022 06:40 — forked from ayerdines/generic_job.rb
handle_asynchronously, delay with sidekiq, make sidekiq work with instance methods
class GenericJob
include Sidekiq::Job
def perform(klass, id, undelayed_method, *args)
object = klass.constantize.find(id)
object.send(undelayed_method, *args)
end
end
@pbharadiya
pbharadiya / reviewable_shortcuts.json
Last active August 17, 2020 08:10
Favourite shortcuts for Reviewable - https://reviewable.io/bindings.json
[
["f", "Show next/latest diffs", "setProposedDiffBounds()"],
[null, "Next unreviewed file", "nextUnreviewedFile()"],
[null, "Previous unreviewed file", "prevUnreviewedFile()"],
["n", "Next personally unreviewed file", "nextPersonallyUnreviewedFile()"],
["p", "Previous personally unreviewed file", "prevPersonallyUnreviewedFile()"],
[null, "Next changed file", "nextChangedFile()"],
[null, "Previous changed file", "prevChangedFile()"],
[null, "Next visible file", "nextVisibleFile()"],
@pbharadiya
pbharadiya / .irbrc
Created May 8, 2020 12:53 — forked from rishiip/.irbrc
This is my current irbrc file which contains lots of helpful things.
# ActiveRecord::Base.logger.level = 1
# IRB.conf[:ECHO] = false
# Overriding Object class
class Object
# Easily print methods local to an object's class
def lm
(methods - Object.instance_methods).sort
end
@pbharadiya
pbharadiya / VS Code.rb
Created December 23, 2019 07:37
Ruby favourite extensions for VS Code
Name: VSCode Ruby
Id: wingrunr21.vscode-ruby
Description: Syntax highlighing, snippet, and language configuration support for Ruby
Version: 0.26.0
Publisher: Stafford Brunk
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=wingrunr21.vscode-ruby
Name: Beautify
Id: hookyqr.beautify
Description: Beautify code in place for VS Code
@pbharadiya
pbharadiya / install.sh
Created May 6, 2019 09:46 — forked from maanavshah/install.sh
Install and Configure Ruby on Rails, MongoDB, PostgreSQL, Git, Sublime Text, Oh-my-zsh and Deepin on Ubuntu
#!/bin/bash
sudo apt-get update
# To make sure we have everything necessary for Webpacker support in Rails, we're first going to start by adding the Node.js and Yarn repositories to our system before installing them.
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
#!/bin/bash
array=( 15354 15359 )
for i in "${array[@]}"
do
# do whatever on $i
echo "-------------------"
PULL_ID=$i
cwd=$(pwd)
TOKEN="YOUR_GITHUB_TOKEN"
curl -H "Authorization: token $TOKEN" -H "Accept: application/vnd.github.v3.patch" https://api.github.com/repos/amuratech/crm/pulls/$PULL_ID | git am
@pbharadiya
pbharadiya / gist:daa8f98d59055e4650308e57e93bf5ab
Created May 16, 2018 07:30 — forked from ben-av/gist:3608264
Capistrano - deployment email with list of git commits
namespace :release do
desc "get current commit in remote server"
task :before do
begin
remote_sha = capture("cd #{current_path}; git rev-parse --verify HEAD")
set :remote_before_commit, remote_sha.strip
# first time deploy can throw exception
rescue
end
end
@pbharadiya
pbharadiya / pre-commit
Last active May 15, 2018 09:45
Pre-commit hook to avoid debugger commands - Ruby
# This script verifies if a list of "undesired" words are presented in the files you are intended to commit such console
# output, debugging information or keys/tokens/passwords
# Based on the git hook created by Mark Story
# http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
# Instructions:
# Put this file into your .git/hooks folder and set as executable (chmod +x pre-commit)
# If you want to skip the hook just add the --no-verify: git commit --no-verify
@pbharadiya
pbharadiya / pr_titles_with_author.js
Last active March 4, 2022 11:40
Get list of Github PR title and it's author name.
/* ##### Author: pbharadiya ##### */
// Below is the script to get all the PRs' title visible on UI. (PER_PAGE-25 for github)
// Copy-paste below line on Javascript console of Pull Requests page.
// How to open JavaScript console: Press ctrl + shift + i
var arr = Array.from(document.getElementsByClassName('Link--primary v-align-middle'));
var str = ""
arr.forEach(function(item) {
if (!item.innerText.includes('ESTATE') ) {
//console.log(item.innerText);