Skip to content

Instantly share code, notes, and snippets.

View ac887266's full-sized avatar

Ashok Choudhary ac887266

View GitHub Profile
import axios from "axios";
import React, { useCallback, useState } from "react";
const FirstComponent = () => {
const [suggestions, setSuggestions] = useState("");
const debounce = (func) => {
let timer;
return function (...args) {
const context = this;
/**
* @param {*} data
* return the data in the format of excel
* import moment as moment-timezone, to install the moment-timezone use this link - https://www.npmjs.com/package/moment-timezone
*/
getCurrentTimezoneDate(date) {
return moment
.tz(date, Intl.DateTimeFormat().resolvedOptions().timeZone)
.format("MM/DD/YYYY hh:mmA");
}
1. Docker command version - docker --version
2. To run a container - docker run <container_name>
3. To check running container lists - docker ps
4. To create a new container - docker create -it <container_name> /bin/bash
5. To start and attach STDIN (output in console) - docker start -ai <container_id>
6. To list all docker images - docker images
7. To check the status of all containers - docker ps -a
8. To remove all unused images - docker image prune
9. To run container in detach mode - docker run -it -d <container_name>
10. To stop the container - docker stop <container_id>
/**
* to fetch particular key and value from an array
*/
function pluck(array, key) {
return array.map(function (item) {
return item[key];
});
}
// ts file
import { Component } from '@angular/core';
import { Options } from 'ngx-google-places-autocomplete/objects/options/options';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
/**
*
* @param {*} array
* @param {*} key
* @param {*} rowOrderBy
* @param {*} type
* @returns
*/
const sortTableData = (array, key, rowOrderBy, type) => {
let _key = key;
/**
*
* @param {*} date
* @param {*} days
* @returns
*/
addWeekDays(date, days) {
let daysToAdd = days;
const today = moment(date);
const nextWeekStart = today.clone().add(1, "week").weekday(1);
import commonUtils from "./commonUtils";
import { errorReuiredMessage, errorValidationMessage } from "./errorMessages";
import regexUtils from "./regexUtils";
/**
* event handler to check reuired error
* @param {*} form
* @returns error object for error and class
*/
export const validationErrorUtils = (form) => {
printOrder = (order) => {
const input = document.getElementById("printableBox");
html2canvas(input, {
logging: true,
letterRendering: 1,
allowTaint: false,
useCORS: true,
}).then((canvas) => {
const imgData = canvas.toDataURL("image/png");
const pdf = new jsPDF();
const handlePrint = () => {
let column_header = [
"Id",
"Date & Time",
"Valid On Date & Time",
"Username & email",
"Gift by",
"Gift Code",
"Items",
"Type",