Friday, February 28, 2020

JQuery to create Download Link

Simple way to download file without navigating.

Monday, February 17, 2020

Convert CSV data to JSON

CSV Data


Output as JSON

JSON Group by count, output to key value pair json result

Following is the JSON and need to manipulate it in format to groupBy.


Thursday, January 30, 2020

Google Chrome Keyboard Shortcuts


Window and Tab Shortcuts
Ctrl+NOpen a new window
Ctrl+Shft+NOpen a new window in incognito mode
Press Ctrl, and click a linkOpen link in a new tab
Press Shft, and click a linkOpen link in a new window
Alt+F4Close current window
Ctrl+TOpen a new tab
Ctrl+Shft+TReopen the last tab you've closed. Google Chrome remembers the last 10 tabs you've closed.
Drag link to tabOpen link in specified tab
Drag link to space between tabsOpen link in a new tab in the specified position on the tab strip
Ctrl+1 through Ctrl+8Switch to the tab at the specified position number. The number you press represents a position on the tab strip.
Ctrl+9Switch to the last tab
Ctrl+Tab or Ctrl+PgDownSwitch to the next tab
Ctrl+Shft+Tab or Ctrl+PgUpSwitch to the previous tab
Ctrl+W or Ctrl+F4Close current tab or pop-up
Alt+HomeOpen your homepage
Ctrl+O, then select fileOpen a file from your computer in Google Chrome
Address Bar Shortcuts
Type a search termPerform a search using your default search engine
Type the part of the web address that's between 'www.' and '.com', then press Ctrl+EnterAdd www.and .com to your input in the address bar and open the web address
Type a search engine keyword or URL, press Tab, then type a search termPerform a search using the search engine associated with the keyword or the URL. Google Chrome prompts you to press Tab if it recognizes the search engine you're trying to use.
F6 or Ctrl+L or Alt+DHighlight content in the web address area
Type a web address, then press Alt+EnterOpen your web address in a new tab
Shortcuts to open Google Chrome features
Ctrl+BToggle bookmarks bar on and off
Ctrl+HView the History page
Ctrl+JView the Downloads page
Shft+EscapeView the Task manager
Webpage shortcuts
Ctrl+PPrint your current page
F5Reload current page
EscStop page loading
Ctrl+F5 or Shft+F5Reload current page, ignoring cached content
Press Alt, and click a linkDownload link
Ctrl+FOpen find-in-page box
Ctrl+G or F3Find next match for your input in the find-in-page box
Ctrl+Shft+G or Shft+F3Find previous match for your input in the find-in-page box
Ctrl+UView source
Drag link to bookmarks barBookmark the link
Ctrl+DBookmark your current webpage
Ctrl++Make text larger
Ctrl+-Make text smaller
Ctrl+0Return to normal text size
Text shortcuts
Highlight content, then press Ctrl+CCopy content to the clipboard
Place your cursor in a text field, then press Ctrl+V or Shft+InsertPaste current content from the clipboard
Place your cursor in a text field, then press Ctrl+Shft+VPaste current content from the clipboard without formatting
Highlight content in a text field, then press Ctrl+X or Shft+DeleteDelete the content and copy it to the clipboard
More shortcuts
Backspace, or press Alt and the left arrow togetherGo to the previous page in your browsing history for the tab
Shft+Backspace, or press Alt and the right arrow togetherGo to the next page in your browsing history for the tab
Ctrl+K or Ctrl+EPlaces a '?' in the address bar. Type a search term after the '?' to perform a search using your default search engine.
Place your cursor in the address bar, then press Ctrl and the left arrow togetherJump to the previous word in the address bar
Place your cursor in the address bar, then press Ctrl and the right arrow togetherJump to the next word in the address bar
Place your cursor in the address bar, then press Ctrl+BackspaceDelete the previous word in the address bar
Space barScroll down the web page
HomeGo to the top of the page
EndGo to the bottom of the page

Reference

Thursday, January 23, 2020

Simple JaveScript Tricks with Array and Object

Combining Multiple Objects

Consider you have three different objects:
const obj1 = {'No': 1, 'firstname': 'Rakesh'};
const obj2 = {'lastname': 'Patel'};
const obj3 = {'Sex': 'Male','progLang':['.Net','MVC','SharePoint']};

combine all the above 3 object into another object:

const objCombined = {...obj1, ...obj2, ...obj3};

The '…' is the spread operator. You can read more about this in the MDN Web Docs

Check if an object is an array

const obj = {data: 1};
const arr = [1, 2, 3];

Array.isArray(obj);  // false
Array.isArray(arr);  // true

Rest parameter syntax

A function that accepts any number of arguments. There is a special syntax called the rest parameter syntax to create such a function.

Example 1:

function test(...values) {
    console.log(values);
}
test(1);
test(1, 2);
test(1, 2, 3);
test(1, 2, 3, 4);

output:
[1]
[1, 2]
[1, 2, 3]
[1, 2, 3, 4]

you can even pass object as a arguments

Example 2:

function sum(...values) {
    let sum = 0;
    for (let i = 0; i < values.length; i++) {
        sum += values[i];
    }
  
    return sum;
}

console.log(sum(1));
console.log(sum(1, 2));
console.log(sum(1, 2, 3));
console.log(sum(1, 2, 3, 4));

output:
1
3
6
10


Saturday, January 18, 2020

Fill element on hover

Create a button so that on hover the background color fills the element from left, right or center side of the element.

OUT Put


From center towards left and right

NEXT

From center towards top and bottom

NEXT

From center towards corners

NEXT

From right to left

NEXT

From left to right

NEXT

From bottom to top

NEXT

From top to bottom

NEXT

Friday, January 17, 2020

Shortcode in a WordPress Template

Shortcodes in WordPress are invoke for some kind of function to accomplish certain tasks. But what if you want to use a shortcode from within a template instead of with the content of a Post/Page?
You can invoke it with a special function: