Skip to content

Instantly share code, notes, and snippets.

View ridwanray's full-sized avatar
💭
I'm Always Learning and Implementing New Things

ridwanray

💭
I'm Always Learning and Implementing New Things
View GitHub Profile
@ridwanray
ridwanray / gist:8eb611dde2412a2758d056a94e12f0f6
Created August 12, 2021 15:37
Javacript Dynamic FIltering
const data = [
{
"address": "1234 Example Lane",
"city": "Portland",
"state": "OR",
"zip": "97201",
"listPrice": 350000,
"daysActive": 12,
"type": "House",
"yearBuilt": 1908,
@ridwanray
ridwanray / gist:b72e20075d5299912fccdda3bab7cc31
Created August 10, 2021 09:50
Map function Template in React js
{cartItems.map((item) => (
<React.Fragment key={item.id}>
<img
className=""
src={item.src}
alt=""
width="100"
height="120"
/>
&nbsp;
@ridwanray
ridwanray / .gitignore
Created August 7, 2021 13:34 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@ridwanray
ridwanray / users.json
Created August 7, 2021 03:17 — forked from jefelewis/users.json
JSON Users
{
"users": [
{
"id": "1",
"firstName": "Kristin",
"lastName": "Smith",
"occupation": "Teacher",
"reviewCount": "6",
"reviewScore": "5",
},
@ridwanray
ridwanray / how-to-copy-aws-rds-to-local.md
Created July 13, 2021 17:40 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@ridwanray
ridwanray / System Design.md
Created June 10, 2021 17:42 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@ridwanray
ridwanray / django_channels_aws_eb_alb.md
Created May 8, 2021 09:12 — forked from mortenege/django_channels_aws_eb_alb.md
Django Channels on AWS Elastic Beanstalk using an ALB

Django Channels on AWS Elastic Beanstalk using an ALB

This post will describe how to set up a Django Channels solution using AWS Elastic Beanstalk [EB]. This guide is written in response to there being very little information on the combination of Channels and AWS. Mainly many solutions end with problems regarding websockets, which is a fundamental part of Channels. See here and here. This guide will consist of multiple step-by-step parts including

  • How to set up a local Django Channels solution
  • How to set up an Application Load Balancer [ALB] to serve websockets
  • How to configure EB to deploy Cha
@ridwanray
ridwanray / save-pdf.py
Created April 25, 2021 22:07 — forked from priyadhoundiyal/save-pdf.py
generate pdf from template and save to db
from django.template.loader import get_template
from django.template import RequestContext
from django.http import HttpResponse
from django.conf import settings
from weasyprint import HTML, CSS
from django.core.files.uploadedfile import SimpleUploadedFile
@api_view(('GET',))
def savePDF(request, *args, **kwargs):
html_template = get_template('template.html')
@ridwanray
ridwanray / 01_complete_authentication_as_api.md
Created February 19, 2021 22:08 — forked from dgilge/01_complete_authentication_as_api.md
How to implement all needed auth endpoints including login with OAuth2 for a SPA using Django REST framework, django-rest-auth and django-allauth

Complete authentication as API including OAuth2 endpoints

I implemented an auth API for a SPA. This is rarely documented and therefore I want to share here how I did it hoping it will be a help for others.

We are still working on it and I'll update this document accordingly.

This tutorial uses following versions:

Package Version