Skip to content

Instantly share code, notes, and snippets.

@zsumair
zsumair / auth.js
Last active February 28, 2023 09:23
JWT using middleware in nextjs
// Under /lib folder of the frontend
import { jwtVerify, SignJWT } from 'jose' 21.6k (gzipped: 6.6k)
export const getJwtSecretKey () => {
const secret = process.env. JWT_SECRET_KEY;
if (!s ret || secret.length == 0)
throw new Error('The environment variable JWT_SECRET KEY is not set.')
@zsumair
zsumair / webdev_online_resources.md
Created July 16, 2018 19:21 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)

Project Intro

This is a time based Todo App for Mobile Devices and Desktop, Which helps people set tasks not on daily basis but on a weekly basis.A long term app assistant for long tasks that takes time.Users will set an amount of hours they are going to spend on a task (ex: 20 hours) which will help them focus more on the task and complete the task in short time making them more productive.

Why

Since a lot of people have long tasks and long term goals to accomplish and alot of people rely on apps for reminding them and setting deadlines to complete them on time.They are lazy to catch up on it and takes long time to finish the task than it actually requires.

Unique Offering

@zsumair
zsumair / readme.md
Created July 15, 2016 10:14 — forked from xem/readme.md
Maths & trigonometry cheat sheet for 2D games

Conventions

  • o = [xo = 0, yo = 0] is the origin
  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;