Skip to content

Instantly share code, notes, and snippets.

View kleva-j's full-sized avatar
🏠
Working from home

Michael Obasi kleva-j

🏠
Working from home
View GitHub Profile
@kleva-j
kleva-j / index.ts
Created December 9, 2023 15:25
Handle api requests in React.
import { AxiosError, AxiosResponse } from "axios";
type BaseRequest<T, V> = (params?: T) => Promise<AxiosResponse<V>>;
type SuccessResponse<V> = {
code: "success";
data: V;
};
type ErrorResponse<E = AxiosError> = {
@kleva-j
kleva-j / index.tsx
Last active December 9, 2023 15:26
React HTML props in TypeScript.
import * as React from 'react';
export type AProps = React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
export type APropsWithoutRef = React.AnchorHTMLAttributes<HTMLAnchorElement>;
export type AreaProps = React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
export type AreaPropsWithoutRef = React.AreaHTMLAttributes<HTMLAreaElement>;
export type AudioProps = React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
export type AudioPropsWithoutRef = React.AudioHTMLAttributes<HTMLAudioElement>;
export type BaseProps = React.DetailedHTMLProps<React.BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>;
export type BasePropsWithoutRef = React.BaseHTMLAttributes<HTMLBaseElement>;
@kleva-j
kleva-j / endpoint.ts
Last active July 16, 2022 21:00
An implementation of a message queue system in Nodejs
import * as http from 'http';
import * as url from 'url';
import { Incoming } from './incoming.interface';
import { QueuePersistence } from './persist-queues';
let queues: QueuePersistence = new QueuePersistence();
(async () => {
const server = await http.createServer(endpoint);
server.listen(3000);
@bradtraversy
bradtraversy / django_crash_course.MD
Last active July 21, 2024 22:05
Commands for Django 2.x Crash Course

Django Crash Course Commands

# Install pipenv
pip install pipenv
# Create Venv
pipenv shell