Skip to content

Instantly share code, notes, and snippets.

View kabilashgit's full-sized avatar

kabilash kabilashgit

  • Autumn Worldwide
  • Bangalore
View GitHub Profile
@kabilashgit
kabilashgit / api-fix.md
Last active July 25, 2023 07:29
Solution: NextJs Public folder new items not accessible after build.

vercel/next.js#18005

Hi,

To anyone who is reading this thread looking for a solution to access files in the public folder at runtime but would prefer a simple solution that works with next you can do the following:

Create a new folder: "./pages/api/public" Add a new file to the folder: "[[...slug]].js" Add the following code to the file:

@kabilashgit
kabilashgit / index.htm
Created February 21, 2023 08:23 — forked from AllThingsSmitty/index.htm
Simple responsive table in CSS (no JS)
<table>
<thead>
<tr>
<th>Payment</th>
<th>Issue Date</th>
<th>Amount</th>
<th>Period</th>
</tr>
</thead>
<tbody>
@kabilashgit
kabilashgit / node_deploy_server.md
Created July 22, 2022 12:37
Full VPS deployment using Nginx, reverse proxy, pm2, SSL, and Lets Encrypt.

Connecting to the VPS

To connect your VPS server, you can use your server IP, you can create a root password and enter the server with your IP address and password credentials. But the more secure way is using an SSH key.

Creating SSH Key

For MAC OS / Linux / Windows 10 (with openssh)

  1. Launch the Terminal app.
  2. ssh-keygen -t rsa
@kabilashgit
kabilashgit / .htaccess
Created December 30, 2021 12:06 — forked from seoagentur-hamburg/.htaccess
UPDATE 2021/10: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.1 - 08/2020
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################

Git necessary configs

$ git config --global user.name "my name"
$ git config --global user.email "my name"

# That way, you avoid any automatic transformation.
# Set autocrlf to false when you do only windows-only projects, otherwise `warning: LF will be replaced by CRLF.`
$ git config --global core.autocrlf false
@kabilashgit
kabilashgit / file-rename-lowercase.md
Last active April 29, 2024 16:03
rename all files to lower-case in windows

Rename all files in the directory to lowercase

open command line in that direct and run the following command

for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")

replace all subfolder files to lowercase

for /f "Tokens=*" %g in ('dir /b') do (for /f "Tokens=*" %f in ('dir %~fg /l /b /a-d') do (rename "%~fg\%f" "%f"))
@kabilashgit
kabilashgit / htaccess.md
Last active February 5, 2020 11:44
force https with www to any url
RewriteEngine On
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
@kabilashgit
kabilashgit / reset.css
Created May 15, 2019 17:18 — forked from simonausten/reset.css
Email CSS Reset
<style type="text/css">
/****** EMAIL CLIENT BUG FIXES - BEST NOT TO CHANGE THESE ********/
.ExternalClass {
width: 100%;
}
/* Forces Outlook.com to display emails at full width */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; }
/* Forces Outlook.com to display normal line spacing, here is more on that: http://www.emailonacid.com/forum/viewthread/43/ */
@kabilashgit
kabilashgit / htaccess.md
Last active April 17, 2019 07:41
Url rewriting for hiding folder name and open it without folder name

eg: http://example.com/foldername (to) http://example.com

Keep this rule in root .htaccess:

RewriteEngine On

RewriteRule ^(?!foldername/)(.*)$ foldername/$1 [L,NC]

Then have this simplified code in /fodlername/.htaccess:

@kabilashgit
kabilashgit / htaccess.md
Last active December 10, 2019 13:46
www to non www with https

www to non www with https

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]