Install ReactJs on Codeanywhere

The way I did:

  • Log in to https://codeanywhere.com
  • Create a blank container by clicking File > New Connection > Container
  • Choose “Blank Development Stack” Ubuntu OS
  • It will open two tabs
  • Copy Container related information somewhere.  This information will have web address. This is the address you’ll need to view your application.
  • Go to terminal (this should be first opened tab)
sudo apt-get update
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - 
sudo apt-get install nodejs
sudo apt-get install npm 
sudo npm install -g create-react-app 
create-react-app my-react-app 
cd my-react-app 
npm start

You’ll see http://localhost:3000 in your terminal. Ignore that. Use the web address you have copied before.

Happy coding!

jQuery: Using window url parameter

Let’s say we have passed a parameter to URL: www.mysite.com/?page=test

To collect the data form parameter we can use this function:

function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};

use of this code:

getUrlParameter('page');

or

if (getUrlParameter('page') == 'test'){
// do something
}

Increase WordPress upload file size limit

Have you tried to upload file, theme more than 8MB & it showed “The link you followed has expired.”? This is due to the upload file size limit in WP or your php.ini.

Here is how we can solve the problem in three ways. If one doesn’t work, try another one:

  1. Change .htaccess file:
    Go to root folder of your website. Find .htaccess file; if you can’t find, create one. Add the following code:

    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 300
    php_value max_input_time 300
  2. Change php.ini file:
    Go to root folder of your website. Find php.ini file; if you can’t find, create one. Add the following code:

    upload_max_filesize = 64M
    post_max_size = 64M
    max_execution_time = 300
  3. Change functions.php file:
    Find this file from theme folder. Add the following code:

    @ini_set( 'upload_max_size' , '64M' );
    @ini_set( 'post_max_size', '64M');
    @ini_set( 'max_execution_time', '300' );

    Hopefully this will solve your problem.

Ref:

  1. wpbeginner.com
  2. wordpress.org