Skip to content

Instantly share code, notes, and snippets.

View mizanmahi's full-sized avatar
🎯
Focused

Mizan Mahi mizanmahi

🎯
Focused
View GitHub Profile
@mizanmahi
mizanmahi / talkToSpeech.js
Created October 13, 2021 16:27
Js text to speech api
const textToSpeech = (text) => {
const speech = new SpeechSynthesisUtterance(text);
[speech.voice] = speechSynthesis.getVoices();
// sp.rate = ?; //speed of the voice. Default value is 1. lowest = 0.1 and highest = 10
// sp.pitch = ?; //pitch of the voice. Default value is 1. lowest = 0 and highest = 2
speechSynthesis.speak(speech);
};
textToSpeech('Hello TalkJS!');
const array = [
['a', ['m', 'n', 'o']],
['b', ['s', 't', 'u']],
['d', ['e', 'f', 'g']],
]
function getShortestPath(target, array){
let shortest = array[0];
let shortestDistance = Infinity;
for(let i = 0; i < array.length; i++){
// Merging two arrays of objects
// if the object is same in both arrays, then update the quantity else add the object to the new merged array array
const arr1 = [
// from db
{ name: 'orange', qty: 5, vendor_details: { name: 'akash', vendor_id: 8 } },
{ name: 'apple', qty: 10, vendor_details: { name: 'akash', vendor_id: 8 } },
{ name: 'mango', qty: 15, vendor_details: { name: 'akash', vendor_id: 8 } },
];
const district = 'barisal';
const customerCategory = 'residential';
const averageElectricityConsumptionCost = 1800; // tk
const unitInfo = {
barisal: {
residential: [
{
min: 0,
max: 50,
[
{
"title": "Book 1",
"author": ["Author 1", "Author 2"],
"genre": "Mystery",
"publicationYear": 2020,
"publisher": { "name": "Publisher A", "location": "City A" },
"reviews": [
{ "user": "User 1", "comment": "Great book!" },
{ "user": "User 2", "comment": "Interesting plot" }
@mizanmahi
mizanmahi / unitCalculator.js
Created August 31, 2023 18:26
unit calculator
const unitRateInfo = {
andhrapradesh: [
{
minUnit: 1,
maxUnit: 30,
totalUnit: 30,
rate: 1.9,
maxCost: 57,
},
{
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"foreground": "#01F0FF",
"style": "plain",
"template": " {{ .UserName }} ",