Skip to content

Instantly share code, notes, and snippets.

View nsisodiya's full-sized avatar

Narendra Sisodiya nsisodiya

View GitHub Profile
@nsisodiya
nsisodiya / .gitlab-ci.yml
Created November 29, 2019 14:16
.gitlab-ci.yml
image: node:9-alpine
stages:
- lint_test
- build
lint_test:
stage: lint_test
before_script:
- echo registry=https://nexus.growerhub.io/repository/npm-group/ >> ~/.npmrc
@nsisodiya
nsisodiya / .zshrc
Created October 17, 2019 06:54
my zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/narendrasisodiya/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@nsisodiya
nsisodiya / kubernetes.sh
Last active July 5, 2019 12:25
Kubernetes Learning WIP
# virtualbox
Install from https://www.virtualbox.org/wiki/Downloads
# kubernetes-cli
brew install kubernetes-cli
# minikube
brew cask install minikube
minikube start
function convertTimeStampToTime(timeStamp) {
let date = new Date(timeStamp);
let hours = date.getHours();
let minutes = date.getMinutes();
if (`${hours}:${minutes}` === '12:0') {
return '12:00 Noon';
}
if (`${hours}:${minutes}` === '0:0') {
return '12:00 MidNight';
}
Array.prototype.asyncMapPool = async function(n, t) {
var r = [],
i = this.map(() => !1),
o = this.length,
e = this;
return new Promise(function(a, s) {
function f() {
if (h < o) {
var t = h;
r.push(
@nsisodiya
nsisodiya / main.js
Created June 14, 2019 17:05
get start and end time stamp for a given date in a given timezone.
var moment = require("moment-timezone");
function getStartEndTimestampsonGivenTimezone(dateStr, timeZone) {
var endDateStr = moment(dateStr)
.add(1, "days")
.format("YYYY-MM-DD");
return {
startTimeStamp: parseInt(moment.tz(dateStr, timeZone).format("x"), 10),
endTimeStamp: parseInt(moment.tz(endDateStr, timeZone).format("x"), 10) - 1
};
@nsisodiya
nsisodiya / main.js
Created June 14, 2019 08:22
The best Way to run multiple async functions parallel and sequential using Array Async Map
var getTime = (function() {
var startTime = Date.now();
return function() {
return (Date.now() - startTime) / 1000;
};
})();
Array.prototype.asyncMapP = function(callback) {
return Promise.all(this.map(callback));
};
Array.prototype.asyncMapS = async function(callback) {
#!/usr/bin/env sh
EMAIL=$(git config user.email)
if [ -z "$EMAIL" ]; then
# user.email is empty
echo "ERROR: Aborting commit. user.email is missing. \
Configure repo specific user.email for this repository by running: \
'$ git config user.email name@example.com'"
exit 1
@nsisodiya
nsisodiya / .git_config
Created May 28, 2019 09:10
.git/config Sample
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git@github.com:nsisodiya/capture-website.git
fetch = +refs/heads/*:refs/remotes/origin/*
@nsisodiya
nsisodiya / git.sh
Created May 28, 2019 09:07
repo specific user name and email
git config user.name "Narendra Sisodiya"
git config user.email "narendra.sisodiya.1983@gmail.com"