Basic Email Signature

Basic Email Signature

<!DOCTYPE html>
<html>
<head>
	<title>CoverWeb</title>
</head>
<body>
	<div style="max-width:width:250px;">
		<img src="https://old.garthbaker.co.za/wp-content/uploads/2020/08/Logo-250x250-1.png" style="width:250px; height:auto;"/>
		<div style="padding:10px 28px;">
			<p><b>Email :</b> info@coverweb.co.za</p>
		</div>
	</div>
</body>
</html>

The above signature looks like this


Email : info@coverweb.co.za

Ubuntu Add Virtual Ram

free -m
mkdir -p /var/swapmemory
cd /var/swapmemory
#Here, 1M * 2000 ~= 2GB of swap memory
dd if=/dev/zero of=swapfile bs=1M count=2000
mkswap swapfile
swapon swapfile
chmod 600 swapfile
echo "/var/swapmemory/swapfile none swap sw 0 0" >> /etc/fstab
#cat /proc/meminfo
free -m

Laravel – Remove Public from URL using htaccess

https://hdtuto.com/article/laravel-remove-public-from-url-using-htaccess

Step 1: Rename File

In first step it is very easy and you need to just rename file name. you have to rename server.php to index.php at your laravel root directory.

server.php
INTO
index.php

Step 2: Update .htaccess

first of all you have to copy .htaccess file and put it laravel root folder. You just copy .htaccess file from public folder and then update bellow code:

.htaccess

Options -MultiViews -Indexes

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]

Image Upload with Reset Button

      <div class="form-row">
        <div class="container">
          <label class="ants-label-light" >Club Emblem</label>
        </div>
          <div class="input-group mb-6 container justify-content-center">
            <div class="row">
              <div class="col-6">
                <form action="/uploads" method="post" enctype="multipart/form-data">
                  <label class="btn btn-ants">
                    <i class="fa fa-image"></i> Upload Club Emblem
                    <input type="file" style="display: none;" name="club_emblem" id="imgInp">
                  </label>
                </form>
              </div>
              <div class="col-6">
                <label class="btn btn-secondary file_reset"> <!-- Remove Image -->
                  <i class="fa fa-undo"></i>
                </label>
              </div>
            </div>
          <div class="image-display-box">
            <form runat="server">
              <img class="upload_display" src="#" alt="Club Emblem" />
            </form>
          </div>
        </div>
      </div>
$( document ).ready(function() {
  // ///////////////////////////////////////////////////////////////////////////
    function readURL(input) {
      if (input.files && input.files[0]) {
        var reader = new FileReader();
        reader.onload = function(e) {
          $('.upload_display').attr('src', e.target.result);
        }
        reader.readAsDataURL(input.files[0]); // convert to base64 string
      }
    }
    $("#imgInp").change(function() {
      readURL(this);
    });
    $('.file_reset').on('click', function() {
      $('.upload_display').attr('src', '');
    });
  // ///////////////////////////////////////////////////////////////////////////
});

Javascript Prevent Page Hot Reload

document.onkeydown = function() {    
     switch (event.keyCode) { 
         case 116 : //F5 button
             event.returnValue = false;
             event.keyCode = 0;
             return false; 
         case 82 : //R button
             if (event.ctrlKey) { 
                 event.returnValue = false; 
                 event.keyCode = 0;  
                 return false; 
             } 
     }
 }

Laravel All Routes Returning 404

Replace your .htaccess file with the below solution contents

Solution:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>

Laravel New Project

use this one through composer:
composer create-project laravel/laravel

This is an older one I tried previously use the one above first:
composer create-project --prefer-dist laravel/laravel blog "5.8.*"

Laravel Install or Update

composer global require "laravel/installer=~1.1"

Since I installed laravel/installer globally via

composer global require laravel/installer

So I update laravel/installer globally via:

composer global update laravel/installer

Then do:

composer global show

and I see

laravel/installer             v2.3.0  Laravel application installer.

Now I can install a fresh Laravel with auth flag!

laravel new project --auth

This command:

laravel new my-test-app --auth

Is the shorthand of four following commands:

Laravel new my-test-appcd my-test-appcomposer require laravel/ui --devphp artisan ui vue --auth

To initialize the Laravel project you need to:

php artisan migratenpm install
npm run dev

Mobile Responsive Design

When creating mobile optimization stick to only 2 media queries. This is a good rule of thumb to keep your CSS compatible throughout and clean, there is no standard or rule saying you are not allowed to use other media queries.
It's just a something I learnt works well for me to keep things compatible throughout and keeps code cleaner.

@media only screen and (min-width: 1024px) {
  body {
    background-color: lightblue;
  }
}

@media only screen and (max-width: 1023px) {
  body {
    background-color: lightblue;
  }
}