Skip to content

Instantly share code, notes, and snippets.

View imlana21's full-sized avatar
♾️
Learning

imlana imlana21

♾️
Learning
View GitHub Profile
@imlana21
imlana21 / fixed-sidebar.html
Last active November 2, 2021 12:46
Creating a responsive sidebar with tailwind
<div className="flex">
<aside class="overflow-hidden inset-0 flex-none h-screen hidden w-full lg:sticky lg:overflow-y-visible lg:w-64 lg:block xl:w-72">
<div class="h-full overflow-y-auto overflow-x-hidden lg:h-screen lg:block lg:sticky">
// Sidebar Content
</div>
</aside>
<main class="w-full overflow-hidden lg:static lg:h-screen lg:overflow-y-visible">
<div className="w-full">
// Main Content
</div>
@imlana21
imlana21 / .env.local
Last active November 3, 2021 04:17
Next Fullstack Configuration
DB_CLIENT=mysql
DB_PORT=3306
DB_HOST=127.0.0.1
DB_NAME=nextfullstack
DB_USER=
DB_PASS=
BASE_URL=http://localhost:3000/
@imlana21
imlana21 / jwt-decode.ts
Created May 27, 2022 12:36
JWT Token Decode Header and Payload to JSON
export default function jwtDecode(token: any) {
const base64Urls = token.split('.');
base64Urls.map( (url: string, i: number) => {
if(i<2)
base64Urls[i].replace(/-/g, '+').replace(/_/g, '/');
});
const jwtHeader = JSON.parse(Buffer.from(base64Urls[0], 'base64').toString());
const jwtPayload = JSON.parse(Buffer.from(base64Urls[1], 'base64').toString());