This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const statesWithCities = [ | |
{ | |
stateName: "Islamabad", | |
cities: ["Islamabad"], | |
}, | |
{ | |
stateName: "Punjab", | |
cities: [ | |
"Ahmed Nager Chatha", | |
"Ahmadpur East", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let string = "NodeJS is single threaded"; | |
let array = []; | |
let ress = ""; | |
let reversed = ""; | |
let tempVal = ""; | |
let str = string ; | |
for (let index = 0; index < str.length; index++) { | |
if (str[index] != " " || (index +1) === (str.length)) { | |
tempVal += str[index]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const asyncLocalStorage = { | |
setItem: function (key, value) { | |
return Promise.resolve().then(function () { | |
localStorage.setItem(key, value); | |
}); | |
}, | |
getItem: function (key) { | |
return Promise.resolve().then(function () { | |
return localStorage.getItem(key); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const storage = multer.diskStorage({ | |
destination: function (req, file, cb) { | |
cb(null, "uploads/"); | |
}, | |
filename: function (req, file, cb) { | |
const uniqueSuffix = Date.now() + "-" + Math.round(Math.random() * 1e9); | |
req.body.image = uniqueSuffix + path.extname(file.originalname); | |
cb(null, uniqueSuffix + path.extname(file.originalname)); | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const multer = require("multer"); | |
const MulterAzureStorage = require('multer-azure-blob-storage').MulterAzureStorage; | |
const { ApiResponse, generateString } = require("../helpers"); | |
require("dotenv").config() | |
//upload to azure blob storage | |
const resolveBlobName = (req, file) => { | |
return new Promise((resolve, reject) => { | |
const blobName = generateString(20) + path.extname(file.originalname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const categories = [ | |
{id:1, name:"Web Design"}, | |
{id:2, name:"Web Development"}, | |
{id:3, name:"Logo Design"} | |
] | |
const data = [ | |
{id:1, title:"Some title", category: "Web Design"}, | |
{id:1, title:"Some title", category: "Some new"}, | |
{id:1, title:"Some title", category: "Web Design"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const calcMinutes = (time="12:30 AM-07:30 PM") => { | |
const _time = time.split("-") | |
const lastMeridian = _time[1].slice(-2) | |
let firstDate = "2022-01-01" | |
let lastDate = "2022-01-01" | |
if(lastMeridian=="AM"){ | |
firstDate = "2022-01-02" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const QuestionsMarks =(str="acc?7??sss?3rr1??????5")=>{ | |
numberCount = 0 | |
markCount = 0 | |
markUsed=0 | |
numberSum = 0 | |
lastAdded=0 | |
result = false | |
str.split("").forEach((item) => { | |
if(!isNaN(item)) numberCount=1 | |
if(numberCount>0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="React Routes" stopProcessing="true"> | |
<match url=".*" /> | |
<conditions logicalGrouping="MatchAll"> | |
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> | |
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const a = [1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1] | |
let count = 0 | |
let _count = [] | |
a.forEach((item, index)=> { | |
if(item==1){ | |
count = count + 1 | |
if(index==a.length-1) _count.push(count) | |
} | |
else{ |
OlderNewer