Skip to content

Instantly share code, notes, and snippets.

View devvspaces's full-sized avatar
👩‍💻
Blockchain and Web3

Ayanwola Ayomide devvspaces

👩‍💻
Blockchain and Web3
View GitHub Profile
@devvspaces
devvspaces / model_change_func_mixin.py
Created October 24, 2022 07:09
Mixin to monitor changes on model fields, and call a function when a change is detected
from typing import Callable, Dict, List
from django.db import models
class ModelChangeFunc(models.Model):
"""
Mixin to monitor changes on model fields,
and call a function when a change is detected
@devvspaces
devvspaces / states.md
Last active November 18, 2022 11:23
nigerian states with respective local government areas

Another file output, Format:

{
    "State": ["lga1", "lga2", "..."]
}

Data:

@devvspaces
devvspaces / schema.py
Created December 13, 2022 18:35
Code snippet for wrapping Django restframwork swagger api response with Success, Path, Status
from drf_yasg import openapi
from drf_yasg.inspectors import SwaggerAutoSchema
from drf_yasg.openapi import Schema
class BaseSchema(SwaggerAutoSchema):
def wrap_schema(self, schema):
"""Wrap schema with success, status, message, data and path fields
:param schema: Schema to wrap
@devvspaces
devvspaces / deploy.bat
Created February 14, 2023 23:06
Batch script for quickly merging dev branch to main branch
@echo off
title Sync with Main Branch
echo Syncing with Main Branch...
@REM accept batch file arguments
set /p commitMessage=Commit Message:
@devvspaces
devvspaces / deploy.yml
Created September 21, 2023 15:28
Deploying Build artifacts to AWS EC2
name: Deploy Application
on:
push:
branches: [master]
jobs:
deploy:
runs-on: ubuntu-latest
@devvspaces
devvspaces / db.sql
Created January 22, 2024 09:32
Complex SQL query
WITH ForumMembersWithRanked AS (
WITH ForumMembersRanked AS (
SELECT
"members".*,
"user"."picture" AS "user.picture",
ROW_NUMBER() OVER (PARTITION BY "members"."ForumId" ORDER BY "members"."id") AS row_num
FROM
"ForumMembers" AS "members"
LEFT OUTER JOIN