Skip to content

Instantly share code, notes, and snippets.

View desaiuditd's full-sized avatar
🚀

Udit Desai desaiuditd

🚀
View GitHub Profile
@desaiuditd
desaiuditd / ucfirst.java
Created February 16, 2016 21:26 — forked from jimjam88/ucfirst.java
Java mimic of PHP's ucfirst function
/**
* Mimics PHP's ucfirst function.
*
* @param subject The string to be ucfirst'd
* @return The subject string with an uppercased first character
*/
final public static String ucfirst(String subject)
{
return Character.toUpperCase(subject.charAt(0)) + subject.substring(1);
}

Keybase proof

I hereby claim:

  • I am desaiuditd on github.
  • I am desaiuditd (https://keybase.io/desaiuditd) on keybase.
  • I have a public key whose fingerprint is 2C76 0DDF EAF3 3C66 B687 FCFB 7F21 FD23 2244 74F5

To claim this, I am signing this object:

@desaiuditd
desaiuditd / meteor-nginx-proxy-config.conf
Last active July 25, 2016 17:55
Meteor Nginx Proxy Config
server {
server_name example.com www.home.example.com;
access_log /var/log/nginx/example.com.access.log ;
error_log /var/log/nginx/example.com.error.log;
docker run \
--rm \
--link mongodb:mongo \
-v /home/ubuntu/backup-dir:/backup \
mongo \
bash -c ‘mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR’
@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."

@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 / 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 / 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 / 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 / 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';
/**