Skip to content

Instantly share code, notes, and snippets.

View thatanjan's full-sized avatar

Anjan Shomodder thatanjan

View GitHub Profile
@thatanjan
thatanjan / countryData.js
Created September 19, 2023 11:13
country data
const fs = require('fs')
const finalData = [
]
;(async () => {
const res = await fetch('https://restcountries.com/v3.1/all?fields=name,cca2,independent,idd')
const data = await res.json()
@thatanjan
thatanjan / config.jsonc
Created June 21, 2023 15:42
waybar config
[{
"include": "~/.config/hypr/waybar/modules",
"layer": "bottom",
//"mode": "dock",
"exclusive": true,
"passthrough": false,
"position": "top",
"spacing": 5,
"fixed-center": true,
"ipc": true,
@thatanjan
thatanjan / .eslintrc.json
Created May 14, 2021 02:41
Eslint configuration for React with typescript
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"airbnb",
"prettier",
],
@thatanjan
thatanjan / GetCookies.tsx
Last active December 7, 2021 22:23
Access cookies in nextjs from server side
import { GetServerSideProps } from 'next'
export const getServerSideProps: GetServerSideProps = async (ctx) => {
const { req, res } = ctx
const {cookies} = req
return { props: { } }
}
@thatanjan
thatanjan / redirect.jsx
Last active February 21, 2021 14:41
Redirect in nextjs from server side.
export const getServerSideProps = async () => {
// check if the user is logged in
const ifAuthenticated = false
if (ifAuthenticated) {
return { redirect: { destination: '/login', permanent: false } }
}
return { props: {} }
}