Ubuntu Add Virtual Ram
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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
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
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
How to SSH to your hosting server

ssh ftpuser@domainname Or
ssh ftpuser@serverIPAddress Or
ssh user@mydomain.com

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
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<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>
<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>
      <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>
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$( 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', '');
});
// ///////////////////////////////////////////////////////////////////////////
});
$( 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', ''); }); // /////////////////////////////////////////////////////////////////////////// });
$( 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
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
}
}
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; } } }
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; 
             } 
     }
 }

Search

Your Favourite Posts

  • Your favorites will be here.

Latest Content

© Garth Baker 2025 All rights reserved.

Pin It on Pinterest

Garth Baker
en
af
sq
am
ar
hy
az
eu
be
bn
bs
bg
ca
ceb
ny
zh-CN
zh-TW
co
hr
cs
da
nl
en
eo
et
tl
fi
fr
fy
gl
ka
de
el
gu
ht
ha
haw
iw
hi
hmn
hu
is
ig
id
ga
it
ja
jw
kn
kk
km
ko
ku
ky
lo
la
lv
lt
lb
mk
mg
ms
ml
mt
mi
mr
mn
my
ne
no
ps
fa
pl
pt
pa
ro
ru
sm
gd
sr
st
sn
sd
si
sk
sl
so
es
su
sw
sv
tg
ta
te
th
tr
uk
ur
uz
vi
cy
xh
yi
yo
zu
Share This