How to send a PHP array to JS object in WordPress

To make a PHP array available to JavaScript (js), first have to encode it in json. Then pass the json object to Javascript.

Its important NOT to include any quote mark while defining the js variable.

$jsonContent = […] Continue Reading…

Posted in Javascript, wordpress | Leave a comment

Get Year month and date in Javascript

This is a simple example on How to handle Javascript Date, month and day.

Click the button to display the formatted numbers.

<button>Try it</button>

function formatDate() {
var date = new Date(1531633030787)
var monthNames = [
“January”, “February”, “March”,
“April”, “May”, “June”, “July”,
“August”, […] Continue Reading…

Posted in Javascript | Leave a comment

nodemon – Internal watch failed: watch ENOSPC

Recently I have faced issue:
[nodemon] Internal watch failed: ENOSPC: no space left on device

To solve it: I just run the following command:
echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

And its resolve the […] Continue Reading…

Posted in NodeJS | Tagged , | Leave a comment

Useful Git Commands

Override local
Sometime, we need to discard local changes, and need to download the repository from server. General git command git pull failed in this occasion.

By this way, any of your local changes will be lost, […] Continue Reading…

Posted in Uncategorized | Leave a comment

Osclass admin listing page – Change number of Listings

Locate File:
Locate the lines:

<select name=”iDisplayLength” class=”select-box-extra select-box-medium float-left” onchange=”this.form.submit();” >
<option value=”10″><?php printf(__(‘%d Listings’), 10); ?></option>
<option value=”25″ <?php if( Params::getParam(‘iDisplayLength’) == 25 ) echo ‘selected’; ?> ><?php printf(__(‘%d Listings’), 25); ?></option>
<option value=”50″ <?php if( […] Continue Reading…

Posted in OSClass, PHP | Tagged , | Leave a comment