Skip to content

Instantly share code, notes, and snippets.


Udit Desai desaiuditd

View GitHub Profile
desaiuditd / vscode-deploy-reloaded-config.json
Last active Nov 9, 2019
Config JSON for Deploy Reloaded extension in VSCode. Copy this json in your workspace settings.json in VSCode.
View vscode-deploy-reloaded-config.json
"deploy.reloaded": {
"fastFileCheck": true,
"fastCheckOnChange": true,
"fastCheckOnSave": true,
"fastCheckOnSync": true,
"showStatusWhenFinished": true,
"values": {
"outputDir": "<local-deploy-path-directory-local-by-flywheel-sites>"
desaiuditd / core.js
Created Sep 16, 2019
Custom Error class in JS
View core.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 / edit.js
Last active Jun 21, 2019
Dynamic Template in InnerBlocks
View edit.js
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 /
Created Dec 24, 2018 — forked from myusuf3/
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 /
Last active Nov 8, 2017
node+express+mongo deploy steps

Install EasyEngine (HTTP Proxy Server)

wget -qO ee && sudo bash ee

Install NVM

curl -o- | bash
desaiuditd /
Last active Jun 1, 2020
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 / phpstorm.vmoptions
Created Jun 21, 2017
PhpStorm / WebStorm VMOptions
View phpstorm.vmoptions
desaiuditd /
Last active Mar 9, 2017
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."

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