Skip to content

Instantly share code, notes, and snippets.

View Shaxadhere's full-sized avatar
🎯
Focusing

Shehzad Ahmed Shaxadhere

🎯
Focusing
View GitHub Profile
@Shaxadhere
Shaxadhere / deployReactAppToCpanel.yml
Last active August 21, 2023 08:14
Deployment pipeline for react app to be deployed on cpanel via github actions, ftp and action secrets.
name: 🚀 Deploy File to cPanel
on:
push:
branches:
- master
jobs:
FTP-Deploy-Action:
name: 🎉 Deploy
runs-on: ubuntu-latest
db.collection.aggregate([
{
"$facet": {
"caseByTitle": [
{
"$match": {
"caseTitle": {
"$regex": ".*godrej.*",
"$options": "i"
}
@Shaxadhere
Shaxadhere / requestInformationLookup.js
Last active December 15, 2022 08:29
get request information in express js server.
const { UAParser } = require("ua-parser-js")
const ipLocator = require('ip-locator')
const parser = new UAParser(req.headers['user-agent']);
const result = parser.getResult()
const ip = req.headers['x-forwarded-for'] || req.socket.remoteAddress
ipLocator.getDomainOrIPDetails(ip, "json", function (err, ipInfo) {
res.json({ result, ipInfo })
});
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
const { Checkout } = require('checkout-sdk-node')
require("dotenv").config()
const cko = new Checkout(process.env.CHECKOUT_SECRET_KEY, { pk: process.env.CHECKOUT_PUBLIC_KEY });
module.exports = makeAPayment = async (token, addressLine1, addressLine2, city, state, zip, amount, country="PK", phone, currency, paymentType, reference, description, customerEmail, customerName) => {
const countryCode = phone.slice(0,3)
const phoneNumber = phone.slice(3,-1)
const payment = await cko.payments.request({
source: {
token: token, // Generated by Checkout.Frames
@Shaxadhere
Shaxadhere / uploadToWasabiCloud.js
Created October 5, 2022 22:54
upload object to wasabi cloud with multer
const { S3Client } = require('@aws-sdk/client-s3');
const AWS = require('aws-sdk');
const multer = require('multer')
const multerS3 = require('multer-s3')
const ep = new AWS.Endpoint('s3.wasabisys.com');
const { generateString } = require("./index")
const s3 = new S3Client({
endpoint: ep,
export const getPrograms = () => {
const degrees = [
"Matriculation in Science",
"Matriculation in Computer Science",
"Intermediate Pre Engineering",
"Intermediate Medical",
"Intermediate Computer Science",
"Intermediate Arts",
"Intermediate Commerce",
"Associate Degree in Accounting Finance",
const s3 = new AWS.S3({
accessKeyId: process.env.AWS_ACCESS_KEY,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
});
const uploadFile = () => {
fs.readFile(file.filepath, (err, data) => {
if (err) {
res.status(400).send(ApiResponse({}, err.message, false));
}
function getDayNames(from, to) {
var d = new Date(from),
to = new Date(to),
a = [],
y = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
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{