Skip to content

Instantly share code, notes, and snippets.

View lordsarcastic's full-sized avatar
🌳
Abide with me, fast falls the eventide

lordsarcastic lordsarcastic

🌳
Abide with me, fast falls the eventide
View GitHub Profile
@lordsarcastic
lordsarcastic / How I implement external service calls for frontend.md
Last active February 7, 2025 04:53
How I implement external service calls for frontend (apart from Angular)

This outlines how I usually implement external service calls on the frontend. We use classes and leverage advantages to craft a compact and easily portable way to make API calls. Note that this could absolutely be done with functions, but I created this gist out of demand.

GitHub gist is just annoying and doesn't line up the files as you create them. Instead it orders it alphabetically. When I have time, I'll fix it. For now, manage it as it is.

Note: Treat hyphen (-) in file names as a directory slash (/).

@lordsarcastic
lordsarcastic / Implement OTP for Django application for multiple uses
Last active April 24, 2024 14:06
This is a generic implementation of OTP for Django applications. It can be extended to any framework or platform that uses OTP.
This is a robust implementation that is extensible for anything that requires the use of OTP. Want to use OTP to verify
a user? Check! Want to use OTP to validate an order? CHeck! Want to use OTP to reset a password? CHEck! Want to use
OTP to verify a device? CHECk! Want to use OTP to fight people? CHECK!
I used: Django (framework), Django Rest Framework (a plugin for REST API), PostgreSQL (database)
and email (for sending the otp). You can substitute any of these for whatever you want, like using Redis instead of Postgres.
While this solution is built to be used for Django, I have added comments to explain the process for developers using
other frameworks.
Legend:
@lordsarcastic
lordsarcastic / Customize Djoser return data
Last active March 29, 2023 04:21
Return more information for user on signup in Django Djoser
.
@lordsarcastic
lordsarcastic / Add user data to access and refresh token on Django simple jwt
Last active March 29, 2023 04:22
Add more details to the access and refresh token gotten from login on SimpleJWT with Django
.