Skip to content

Instantly share code, notes, and snippets.

View nsisodiya's full-sized avatar

Narendra Sisodiya nsisodiya

View GitHub Profile
save-exact=true
save=true
@nsisodiya
nsisodiya / .gitlab-ci.yml
Last active November 30, 2019 15:46
.gitlab-ci.yml
image: node:9-alpine
stages:
- lint_test
- build
lint_test:
stage: lint_test
before_script:
- echo //registry.npmjs.org/:_authToken=$SYNGENTA_NPM_TOKEN >> ~/.npmrc
@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
#!/usr/bin/env sh
echo "====== Running After Build Scripts ========"
echo "0. === moving public to build ==="
mv public build
echo "1. === Copy index.html to 200.html ==="
cp build/index.html build/200.html
echo -e "Copied\n\n\n"
@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) {