Skip to content

Instantly share code, notes, and snippets.

View sonukapoor's full-sized avatar
🎯
Hello :)

Sonu Kapoor sonukapoor

🎯
Hello :)
View GitHub Profile
@sonukapoor
sonukapoor / GitCommitBestPractices.md
Created June 8, 2022 12:33 — forked from luismts/GitCommitBestPractices.md
Git Tips and Git Commit Best Practices

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.

@sonukapoor
sonukapoor / ngrxintro.md
Created September 9, 2018 00:47 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@sonukapoor
sonukapoor / gist:1e742b200e87b0cec59906126baa45b2
Created August 8, 2018 01:46 — forked from pincheira/gist:2724082
Custom override console.log to display date on every return string
function showDate(){
var date = new Date(),
str = date.toUTCString();
return str;
}
var orig = console.log;
console.log = function() {
@sonukapoor
sonukapoor / nodejs-ubuntu-bind-port-80.md
Created December 29, 2017 16:34 — forked from guifromrio/nodejs-ubuntu-bind-port-80.md
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@sonukapoor
sonukapoor / nginx.sh
Created December 29, 2017 01:40 — forked from makevoid/nginx.sh
nginx init.d file for centos/rhel - /etc/init.d/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@sonukapoor
sonukapoor / gist:ba547f37b49544e101ff8381fdcebcb3
Created December 5, 2017 23:51 — forked from jmervine/gist:2079897
installing mysql on ubuntu using an aws instance
$ sudo apt-get install mysql-server mysql-client
... output omitted ...
$ sudo mysqladmin -u root -h localhost password 'password'
... output omitted ...
$ mysql -u root -p
... output omitted ...
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'your_host_name' IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
@sonukapoor
sonukapoor / README.md
Created August 4, 2017 21:20 — forked from krimple/README.md
Test and class under test for Http mocking - Angular 2 beta 1

This snippet is a working example of a test against the Http service in Angular 2.0.

It is a very simple test, and provides an example of how to:

  • Provide the right wiring to the test injector
  • Inject the fake XHRBackend (i.e. MockBackend)
  • Define a potential request
  • Run the request in the framework
  • Set expectations on the result
@sonukapoor
sonukapoor / couchdb-ec2-install.sh
Created June 12, 2017 20:15 — forked from cesine/couchdb-ec2-install.sh
Set up CouchDB on EC2
#!/bin/bash
#
# For http://stackoverflow.com/questions/6162891/installing-couchdb-in-aws-ec2-free-tier
#
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
# It is a modified fork of the original rake script, but does not use rake (just good ol' linux tools)
# Based on: http://wiki.apache.org/couchdb/Installing_on_RHEL5
# Place the below into the following file: ~/.config/fish/config.fish
# migrating from https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git/git.plugin.zsh
# Aliases
alias g='git'
#compdef g=git
alias gst='git status'
#compdef _git gst=git-status
alias gd='git diff'
#compdef _git gd=git-diff