Skip to content

Instantly share code, notes, and snippets.

View desaiuditd's full-sized avatar
🚀

Udit Desai desaiuditd

🚀
View GitHub Profile
@desaiuditd
desaiuditd / brew-install-packages.md
Last active March 30, 2024 02:30
Homebrew packages
brew install \
  autojump awscli \
  deno diff-so-fancy direnv \
  exiftool \
  neovim \
  git asdf \
  helm helmfile hostess htop \
  jq yq \
 kubectl kubectx kube-ps1 \
@desaiuditd
desaiuditd / vscode-deploy-reloaded-config.json
Last active November 9, 2019 11:07
Config JSON for Deploy Reloaded extension in VSCode. Copy this json in your workspace settings.json in VSCode.
{
"deploy.reloaded": {
"fastFileCheck": true,
"fastCheckOnChange": true,
"fastCheckOnSave": true,
"fastCheckOnSync": true,
"showStatusWhenFinished": true,
"values": {
"outputDir": "<local-deploy-path-directory-local-by-flywheel-sites>"
},
@desaiuditd
desaiuditd / core.js
Created September 16, 2019 01:21
Custom Error class in JS
import myErrorCodes from './error-codes';
import MyError from './error';
const main = () => {
const success = false;
// add some business logic here.
if ( success === false ) {
new MyError(errorCodes.page_not_found);
@desaiuditd
desaiuditd / edit.js
Last active June 21, 2019 07:52
Dynamic Template in InnerBlocks
const { Component, Fragment } = wp.element;
// This is going to add block controls to switch the state between preview and search.
import ItemControls from './controls';
// Preview is going to show users how items are going to look like.
import Preview from './preview';
// Search is allowing to search for items.
import Search from './search';
/**
@desaiuditd
desaiuditd / delete_git_submodule.md
Created December 24, 2018 23:14 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@desaiuditd
desaiuditd / node-express-mongo-deploy.md
Last active November 8, 2017 08:41
node+express+mongo deploy steps

Install EasyEngine (HTTP Proxy Server)

wget -qO ee rt.cx/ee && sudo bash ee

Install NVM

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
@desaiuditd
desaiuditd / git-squash.md
Last active August 20, 2021 10:31
Git Squash Commits and Change Timestamp

Let's say, 5 commits are made in develop branch.

  • Commit 4 => 2017/06/23
  • Commit 3 => 2017/06/22
  • Commit 2 => 2017/06/21
  • Commit 1 => 2017/06/20

Now we want to squash these commits into one commit (i.e., the latest commit on 2017/06/23).

git rebase -i HEAD~4

@desaiuditd
desaiuditd / phpstorm.vmoptions
Created June 21, 2017 22:18
PhpStorm / WebStorm VMOptions
-ea
-server
-Xms2g
-Xmx1g
-Xss16m
-XX:PermSize=256m
-XX:MaxPermSize=1024m
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
@desaiuditd
desaiuditd / squash.md
Last active February 2, 2022 11:07
Squash multiple commits related to single issue in a PR

The workflow says that the master branch of a project is the golden branch from which all development is based off of.

In order to keep this easy to navigate, it is asked that you squash your commits down to a few, or one, discreet changesets before submitting a pull request. Fixing a bug will usually only need one commit, while a larger feature might contain a couple of separate improvements that is easier to track through different commits.

Once you have rebased your work on top of the latest state of the upstream master, you may have several commits related to the issue you were working on. Once everything is done, squash them into a single commit with a descriptive message, like "Issue #100: Retweet bugfix."

docker run \
--rm \
--link mongodb:mongo \
-v /home/ubuntu/backup-dir:/backup \
mongo \
bash -c ‘mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR’