Skip to content

Instantly share code, notes, and snippets.

View mrsid96's full-sized avatar
😎
Open Source Lover

Sidharth Patnaik mrsid96

😎
Open Source Lover
View GitHub Profile
@mrsid96
mrsid96 / dup
Created December 5, 2022 05:54
temp
import React from "react";
const Duplicates = ({ numberList }) => {
let duplicates = []
let uniques = []
let hashMap = {}
numberList.forEach(element => {
if (hashMap[element]) {
@mrsid96
mrsid96 / jsTricks.js
Created August 12, 2021 14:49
Handy Oneliners
const generateCellsValues = (cells) => cells?.reduce((acc, item) => ({
...acc,
[item?.column?.id]: item?.value
}), {})
@mrsid96
mrsid96 / blacklist.json
Last active November 12, 2020 09:23
Blacklisted Device JitSi
[
"Samsung GALAXY J6",
"Samsung GALAXY J8",
"Realme C1",
"Moto G4",
"Redmi 6A",
"Vivo1816",
"Samsung On5",
"Moto E5 Plus",
]
let workOnChannel = async (channel) => {
// ...
//Consumer listening to the queue, which was ealier created and bind with exchange
let { consumerTag } = await channel.consume(queue, function (msg) {
if (msg.content) {
let dataReceive = JSON.parse(msg.content.toString());
console.log(`[✓] Incomming message ${JSON.stringify(dataReceive)}`);
}
}, {
let workOnChannel = async (channel) => {
//The channel here is a regular amqplib `ConfirmChannel`.
let exchange = "myFavExchangeName";
await channel.assertExchange(exchange, 'fanout', {
durable: false
});
let { queue } = await channel.assertQueue('', {
exclusive: true,
autoDelete: true
conn.createChannel({
json: true,
setup: function (channel) {
workOnChannel(channel);
}
});
let workOnChannel = async (channel) => {
//The channel here is a regular amqplib `ConfirmChannel`.
//We will perform our operations here.
@mrsid96
mrsid96 / ampq.connection.js
Last active July 7, 2020 18:21
AMPQ Connection
const amqp = require('amqp-connection-manager');
require('dotenv').config();
//process.env.mqConns is an array of connection string
let conn = amqp.connect(JSON.parse(process.env.mqConns));
conn.on('connect', () => console.log('Connected!'));
conn.on('disconnect', err => console.log('Disconnected.', err));
{
"data": {
"result": {
"KycData": {
"Name": {
"fullName": "Test Name"
},
"Demographics": {
"dateOfBirth": "28/05/1993",
"gender": ""
@mrsid96
mrsid96 / deep.copy.js
Created April 3, 2019 03:11
Cloning the object using Prototyping
var clone = function (obj) {
if (null == obj || "object" != typeof obj) return obj;
var copy = obj.constructor();
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
}
return copy;
}
@mrsid96
mrsid96 / async.map.js
Created March 30, 2019 03:26
async.map
async function asyncFunction(name) {
await collection.find({
"name": new RegExp(name, 'i')
}, (err, res) => {
if(err)
console.log("Error:",err);
else {
async.map(res, (item, callback)=>{
anotherCollection.findById(item.id, (err, res)=>{
if(err)