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
342038736
465977973
@devvspaces
devvspaces / index.html
Created June 20, 2024 10:15
Get Token from Google sign in
<!DOCTYPE html>
<html>
<head>
<title>Sign In with Firebase</title>
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-auth-compat.js"></script>
<script>
// Your web app's Firebase configuration
const firebaseConfig = {
@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
@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 / 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 / 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 / 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 / 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 / managers.py
Created October 21, 2022 05:11
Code snippet from TripValue API consisting of a Vehicle, Trip and Booking managers. The Trip manager is the most interesting, uses django postgres to perform full text search and rank results. The functionality is also built to work fast using caches and optimized complex queries.
import datetime
from typing import Dict, Type, TypeVar, overload
from django.contrib.postgres.search import (SearchQuery, SearchRank,
SearchVector)
from django.db.models import Manager, QuerySet
from utils.base.crypto import hash_digest
from django.core.cache import cache as _cache
from django.conf import settings
from django.core.cache.backends.base import BaseCache