Skip to content

Instantly share code, notes, and snippets.

View adnanirfan's full-sized avatar
🏓
while(true) eat(); sleep(); code();

Adnan Irfan adnanirfan

🏓
while(true) eat(); sleep(); code();
  • Geeks of Kolachi
  • Karachi
View GitHub Profile
@adnanirfan
adnanirfan / PaginationSSR.jsx
Created June 9, 2023 13:46
Next.js component to handle Paginations with Server Side Rednering
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { QueryClient, dehydrate, useQuery } from "@tanstack/react-query";
// import Pagination from "@material-ui/lab/Pagination";
export default function PaginationSSR(props) {
const router = useRouter();
const [page, setPage] = useState(parseInt(router.query.page) || 1);
import axios from 'axios';
import fs from 'fs';
const images = ["https://avatars.githubusercontent.com/u/9200214?s=500&v=2"];
(async () => {
function getImage(url, index) {
try {
axios({
method: 'get',
url,
@adnanirfan
adnanirfan / Server Setup | Nginx | HTTPS SSL - Certbot | DOCKER | Free DNS - Resources.md
Last active August 18, 2023 19:15
Server Setup | Nginx | HTTPS SSL - Certbot | DOCKER | Free DNS - Resources
@adnanirfan
adnanirfan / test.md
Last active December 17, 2022 08:19
Javascript Test - UIT Summer 2022
  1. Write a JavaScript function that reverse a number.

      Example x = 32243;
      Expected Output : 34223
    
  2. Write a JavaScript function that checks whether a passed string is palindrome or not?

      A palindrome is word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run.
    
@adnanirfan
adnanirfan / clear.txt
Created September 22, 2021 16:08 — forked from EQuimper/clear.txt
React-Native clear Watchman + Cache
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
@adnanirfan
adnanirfan / postgres-brew.md
Created July 27, 2021 11:38 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@adnanirfan
adnanirfan / nginx_cors_s3_upload_proxy_full
Created June 18, 2021 16:55 — forked from zefer/nginx_cors_s3_upload_proxy_full
My nginx config to allow CORS (cross-site) uploads to Amazon S3, with added config e.g. timeouts & security
# DO NOT RESPOND TO REQUESTS OTHER THAN yourdomain.com
server {
listen 80 default;
server_name _;
return 444;
}
# FILE UPLOADS
server {
listen 80;
@adnanirfan
adnanirfan / Interview Guide
Created November 29, 2019 22:29 — forked from nomanalikhan/Interview Guide
Interview Guide
- TechStacks/Language
- Javascript
- https://github.com/ganqqwerty/123-Essential-JavaScript-Interview-Questions
- https://www.toptal.com/javascript/10-most-common-javascript-mistakes
- https://www.toptal.com/javascript/interview-questions
- https://medium.com/javascript-in-plain-english/js-engine-and-optimization-dac1f7fcb87d
- https://www.freecodecamp.org/news/javascript-essentials-why-you-should-know-how-the-engine-works-c2cc0d321553/
- https://github.com/yangshun/front-end-interview-handbook
- lexical scoping
- React 16
@adnanirfan
adnanirfan / Nginx.md
Last active February 6, 2023 14:16
Nginx Setup