Source: Linkedin
Month: September 2021
How to fix Magento2 apis not working? fix coupon apis and other PUT OPTIONS APIs
The issue is actually related to your server’s configuration. By default all types of requests are not allowed. Please add the following to your .htaccess file
<Limit GET POST OPTIONS PUT DELETE PROPFIND>
Order allow,deny
Allow from all
Require all granted
</Limit>
CSS Flashy button with glaze effect
.flashybtn
{
display: block;
text-align: center!important;
text-decoration: none!important;
font-weight: 800!important;
font-size: 1.5em;
text-transform: uppercase!important;
color: #fff!important;
padding: 1em 0.1em 1em 0.1em!important;
background-size: 200% auto!important;
box-shadow: 0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08)!important;
background-image: linear-gradient(to right,#ff473d 0%,#ff379d 50%,#f13790 100%)!important;
animation: gradient 1.5s ease infinite!important;
width: 100%;
position: relative; //change to fixed to make it sticky
bottom: 0;
left:0;
z-index: 9999;
}
.flashybtn:before {
content: "";
display: inline-block;
position: absolute;
background: rgb(255,255,255);
width: 30px;
height: 2em;
left: 0;
bottom: 0;
filter: blur(1.5em);
animation: 2s glaze infinite;
}
@keyframes glaze{
from{
transform: translateX(0) skewX(-15deg);
opacity:1;
}
to {
transform: translateX(100vw) skewX(-15deg);
opacity:1;
}
}
I am FLASHY
How to put a site in maintenance? [Apache web server]
ErrorDocument 403 /index.html
DirectoryIndex index.html
<Files ~ "index\.html">
Order Allow,Deny
Allow from all
</Files>
Deny from all
Content of your .htaccess file
If you want to whitelist any IP, use this
ErrorDocument 403 /index.html
DirectoryIndex index.html
<Files ~ "index\.html">
Order Allow,Deny
Allow from all
</Files>
Order Allow,Deny
Allow from xx.xxx.xx.xx
Deny from all
Here is a sample htaccess for a wordpress website with 1 IP whitelisted 4.129.45.44 and all others are banned. So you only will be able to load the website while everyone else will see contents of index.html with HTTP Status code 403
ErrorDocument 403 /index.html
DirectoryIndex index.php
<Files ~ "index\.html">
Order Allow,Deny
Allow from all
</Files>
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^4\.129\.45\.44$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REMOTE_ADDR} !^4\.129\.45\.44$
RewriteRule . /index.php [L]
Allow from 4.129.45.44
Deny from all
How to generate a patch with edited files? How to zip latest committed changes only
zip archive.zip $(git diff-tree --no-commit-id --name-only -r latest-commit-id)
Reference: https://stackoverflow.com/a/42971972/2229148
sometimes you need all the files that were updated so you can patch an external app which doesnt uses same git project or many other scenarios in which we need a zip or tar of those files. Use the above command to do so
There is a smarter way also, if you want all the changes from last 5 commits, use the command like this:
zip archive.zip $(git diff-tree --no-commit-id --name-only -r HEAD~5 HEAD)