Skip to content

Instantly share code, notes, and snippets.

View peteradeojo's full-sized avatar
👋
Available for collaboration

Peter Ade-Ojo peteradeojo

👋
Available for collaboration
View GitHub Profile
@peteradeojo
peteradeojo / model.ts
Created April 25, 2024 21:04
Create API-safe responses with mongoose toJSON()
// model.ts
import mongoose, { Schema } from 'mongoose';
const schema = new Schema({
//...schema definition
});
schema.methods.toJSON = function() {
// ... compute some data to go along with your response
@LordGhostX
LordGhostX / validate_email.py
Last active August 13, 2023 17:09
RegEX to validate email
# validate email addresses
def validate_email(email):
pattern = r"(^(?!-|\.)([a-zA-Z0-9._%+-]+)@(?!-)[a-zA-Z0-9.-]+(?<=[a-zA-Z0-9])\.[a-zA-Z]{2,}$)"
if re.match(pattern, email):
return True
else:
return False
if __name__ == "__main__":
@codaibk
codaibk / MinGW-w64 C++ Compiler.md
Last active July 16, 2025 12:04
MinGW-w64 C/C++ Compiler