Tuesday, December 21, 2021

13 Useful Websites You Wish You Knew Earlier

1. Vocalremover.org

Vocalremover separates the music from the vocals in with a powerful AI algorithm. Upload an mp3 file and let the algorithm do its job! The website also allows you to change the audio pitch without affecting the tempo and vice versa.

2. Unscreen.com

Are you looking for a tool that allows you to remove video background in a couple of clicks? With Unscreen you can remove or change the background from any video or GIF. You can search a GIF directly on the website or upload your own video.

3. Snapdrop.net

If you don’t own an iPhone —meaning that you don’t have AirDrop — you should definitely check Snapdrop out. Open the webpage both on your laptop and phone (the website will automatically connect the devices), drop the files you want to transfer, and they’ll appear on the other device ready to be downloaded. Easy!

4. Smartmockups.com

Create free mockups for any device and physical product! Smartmockups.com is a web app that allows you to generate high quality mockups for your next presentation, website, social media campaign, portfolio and more. To access the service you need an account.

5. Panzoid.com

Do you need video intros, outros, or end screens? This is a great website if you have a YouTube channel and need this type of video material. There are hundreds of templates submitted by the users of the websites. Understanding how this website works might take a few minutes, but it’s surely worth it! Side note: it’s more compatible with Chrome than Safari.

6. Midomi.com

Do you ever think of a song but don’t know the title or how the lyrics go? If yes, Midomi is what you need! Just hum the words and this website will find the song for you.

7. Kamua.com

If you are looking to resize, cut, and caption videos for TikTok or Instagram Reels, this tool is a must have. Transform any horizontal video into a dynamic vertical with this smart tool. You need an account to access the service.

8. Justtherecipe.app

If you love cooking this is the website for you. Sometimes, when you browse recipes online you have to skim through five paragraphs before you can find the actual recipe. With Just The Recipe, you just need to paste the url of the page into the web page, and it will show you the list of the ingredients and the instructions on how to make that food, with no distractions.

9. Jitter.video

Jitter Video is motion design made simple. With this tool, you can create custom motion graphics for free; just select the template you like and start editing! You need an account to access the service.

10. Loading.io

With Loading, you can make simple animations, create loading patterns and backgrounds, and design progress bars. If you need simple animated visual elements, this tool is for you. It might not have the prettiest UI but it sure does its job.

11. Shortlyai.com

What if someone told you that you can write an article without actually writing anything? It’s possible with AI. Go to Shortlyai, pick a topic, choose an output length, input a brief, and the AI will write for you. The service is not free and requires you to have an account.

12. Renderforest.com

This branding platform allows you to create intro and music visualisations. Search through customisable templates and find the one you like. Add your logo, tagline, music, and export! Renderforest helps you create a variety of branded material with minimal time and effort — from videos to logos, mockups, and websites. To access the platform you need to create an account.

13. Naturalreaders.com

This Text-to-Speech tool (TTL) converts any text to audio, allowing you to choose from a variety of voices and accents. You can also download the audio file as mp3, so that you can listen anytime, without Internet connection. This tool is also useful if you need an easy-to-use TTL tool for your Instagram Reels — since Instagram lacks the TTL function TikTok has.


Tuesday, December 14, 2021

Convert Number, String, Float and Format JSON

 1) Convert to String

To quickly convert a number to a string, we can use the concatenation operator (+) plus followed by an empty set of quotation marks "" .

let val = 1 + "";
console.log(val); // Result: "1"
console.log(typeof val); // Result: "string"

2) Convert to Number

The opposite can be quickly achieved using the addition operator + .

let int = "15";
int = +int;
console.log(int); // Result: 15
console.log(typeof int); Result: "number"

This may also be used to convert Booleans to numbers, as below:

console.log(+true);  // Return: 1
console.log(+false); // Return: 0

3)Quick Float to Integer

If you want to convert a float to an integer, you can use Math.floor() , Math.ceil() or Math.round() . But there is also a faster way to truncate a float to an integer using |, the bitwise OR operator.

console.log(23.9 | 0);  // Result: 23
console.log(-23.9 | 0); // Result: -23

4)Format JSON Code

Lastly, you may have used JSON.stringify before, but did you realise it can also help indent your JSON for you?
The stringify() method takes two optional parameters: a replacer function, which you can use to filter the JSON that is displayed, and a space value.
The space value takes an integer for the number of spaces you want or a string (such as '\t' to insert tabs), and it can make it a lot easier to read fetched JSON data.

console.log(JSON.stringify({ alpha: 'A', beta: 'B' }, null, '\t'));
// Result:
// '{
//     "alpha": A,
//     "beta": B
// }'

Monday, December 13, 2021

Get Query Params

window.location object has a bunch of utility methods and properties. We can get information about the protocol, host, port, domain, etc from the browser URLs using these properties and methods. 


var args = window.location.search
let data = new URLSearchParams(location.search).get('reqId');
console.log(data)

Few Javascript or JQuery Tricks for array and operators

 1) Empty an array

var arr = [10 , 20 , 30 ];
arr.length = 0; // arr will be equal to [].


2) Truncate an array using length

Like the previous example of emptying an array, we truncate it using the length property.

var arr = [10, 20, 30, 40, 50, 60, 70, 80, 90];
arr.length = 4; // arr will be equal to [10, 20, 30, 40].

As a bonus, if you set the array length to a higher value, the length will be changed and new items will be added with undefined as a value. The array length is not a read only property.

arr.length = 10; // the new array length is 10
arr[arr.length - 1] ; // arr [10, 20, 30, 40, 50, 60, 70, 80, 90, undefined];


3)Use logical AND/ OR for conditions

var foo = 10;
foo == 10 && doSomething(); // is the same thing as if (foo == 10) doSomething();
foo == 5 || doSomething(); // is the same thing as if (foo != 5) doSomething();


4) Comma operator

var a = 10;
var b = ( a++, 99 );
console.log(a);  // a will be equal to 10
console.log(b);  // b is equal to 99


5) Swap variables

let v1 = 'value 1';
let v2 = 'value 2';

[v1,v2] = [v2, v1];
console.log(v1, v2);


Tuesday, September 21, 2021

Calculate date difference using JQuery

Simple way to get days between 2 dates...

Tuesday, August 17, 2021

Cheat Sheet - CSS, JQuery Selectors and Filters


* All elements.
element Basic selector defined by the elements name. IE – the <p> tag.
.class Elements specified by a specific class attribute.
#id Elements specified by the specific ID number.
selector1, selector2 Elements that match more than one selector.
:first First element from the selection.
:last Last element from the selection.
:even Even index selection.
:odd Odd index selection.
:not(selector) Everything except the selector in parentheses.
:eq() Elements with an index number equal to the parameter.
:gt() Elements with an index number greater than the parameter.
:lt() Elements with an index number less than the parameter.
:header All h1 – h6 HTML tags.
:animated Any element being animated.
:focus The element which has focus (an input item such as a field, checkbox, button, or link).
:empty Elements with no children.
:parent Elements that have a child node.
:has(selector) Elements contain atleast one of the elements that match the selector in parentheses.
:contains(‘text’) Elements that contain the specified text in parentheses.
:hidden Elements that are hidden.
:visible Elements that exist and take up space in the layout of the page.
:nth-child(exp) Elements that match the mathematical pattern. IE –  div :nth-child(2+1)
:first-child First child from the current selection.
:last-child Last child from the current selection.
:only-child The only existing child of the matching element.
[attribute] Elements that have the specified attribute value – IE – [name^ = “value”]
:input Elements with input.
:text Elements with text.
:password Elements with password inputs.
:radio Elements with radio buttons.
:checkbox Elements with checkboxes.
:submit Elements with submit buttons.
:image Elements with images.
:reset Elements with reset buttons.
:button All buttons.
:file Elements with file inputs.
:selected All items from drop-down lists.
:enabled All enables elements, including defaults.
:disabled All disables elements.
:checked All checked checkboxes or radio buttons.

If there’s anything that I’ve missed or more explanation that you’d like to see, feel free to leave a comment.

Help other's to help yourself !!

Wednesday, May 5, 2021

Export HTML table to Excel file

<!-- https://github.com/linways/table-to-excel -->

<script src="https://cdn.jsdelivr.net/gh/linways/table-to-excel@v1.0.4/dist/tableToExcel.js"></script>


function exportReportToExcel(c) {

  let table = $("#feedbackExport2Excel"); // you can use document.getElementById('tableId') as well by providing id to the table tag

  let fileName = "Feedback";

  TableToExcel.convert(table[0], { // html code may contain multiple tables so here we are refering to 1st table tag

    name: `${fileName}.xlsx`, // fileName you could use any name

    sheet: {

      name: 'Sheet 1' // sheetName

    }

  });

}//exportReportToExcel


Wednesday, February 3, 2021

Simple way to find Index value from JSON Array

Simple way to find Index value from JSON Array 


var data = [{"name":"placeHolder","section":"right"},{"name":"Overview","section":"left"},{"name":"ByFunction","section":"left"},{"name":"Time","section":"left"},{"name":"allFit","section":"left"},{"name":"allbMatches","section":"left"},{"name":"allOffers","section":"left"},{"name":"allInterests","section":"left"},{"name":"allResponses","section":"left"},{"name":"divChanged","section":"right"}];

var index = data.findIndex(obj => obj.name=="allInterests");

console.log(index);

Tuesday, February 2, 2021

Add days to a Date using JavaScript

Many times I have face this issue, and hope you too.. this is simple 3 line of code will help and fix this problem.


let days =7 ; // we are going to add 7 days to a date

let cdt = new Date('2021-01-10'); // your date value

let tdt = cdt.setTime(cdt.getTime() + (days * 24 * 60 * 60 * 1000)); // calculation for adding 7 days and adding to time

let targetDT = new Date(tdt).format("yyyy-MM-dd"); // converting back from time to date 

// Output for targetDT will be "2021-01-17"


// With function...

function addDays(theDate, days) {
    return new Date(theDate.getTime() + days*24*60*60*1000);
}

var newDate = addDays(new Date(), 5);


Hope this will help you...

Thursday, January 28, 2021

JavaScript to get index from a JSON object with value

 In modern browsers you can use findIndex:

But this function is not supported by even not so old versions of a few browser as well as in IE (EDGE supports it). So below is a workaround using javascript: You can use either Array.forEach or Array.find or Array.filter

This method takes little more overhead as it loops through the whole object to search for the match. So, for lengthy JSON data, this method is not suggested(even though it gets the work done).

Tuesday, January 5, 2021

Displaying a number in Indian format using JavaScript

Indian money format function